Get StartedCommunity
Search
No results
Enter to navigate
Up and Down keys select

Dynamic data

Dynamic data is if you need to call out to APIs and get the data in the page. It's built right into the page components with a static def GET and works on client and server.

Example fetch products from ./src/pages/products.imba.

export default tag ProductsList
	prop locals
	static def GET req, res, next
		const res = await fetch("/api/products", {
			headers: { Accept: "application/json" }
		})
		res.locals.products = await res.json()
		next!
	<self>
		<div>
			for product in (locals.products or [])
				<div> product.title
				<div> product.price
made by us