Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- type item = {string description, string url}
- database mydb {
- stringmap(item) /items
- }
- /mydb/items["google"] = {description: "search the interwebs with google!", url: "http://google.com"}
- /mydb/items["yahoo"] = {description: "search the interwebs with yahoo!", url: "http://yahoo.com"}
- function render_item(item) {
- <>
- <li>
- <h4>item</h4>
- <a href="/mydb/items[item]/url">{/mydb/items[item]/description}</a>
- </li>
- </>
- }
- function render_index() {
- <>
- <ul>
- {StringMap.iter(function(item) {render_item(item)}, /mydb/items)}
- </ul>
- </>
- }
- Server.start(Server.http, {title: "test", page: render_index})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement