Skip to content
All guides

servers

Your first API

Scaffold, set Postgres, serve.

buraaq new notes
cd notes
$env:BURAAQ_DATABASE_URL = "host=127.0.0.1 port=5432 dbname=app user=postgres"
buraaq up

buraaq new NAME (no --cli) is a Keel project: src/main.bq plus public/index.html.

What up does

Packs a ship, starts a local Dock if needed, and runs the process. Open:

  • http://127.0.0.1:8080: page
  • https://127.0.0.1:8443: same app over TLS (dev cert if you packed cert.pem / key.pem)

For a tight edit loop without packing:

buraaq run

That builds and executes main in the foreground. run() in source does not return: Ctrl+C stops it.

The source you own

fn main() {
    page("/", "public/index.html")
    api("items", "title, body")
    run()
}

Call page / api / store before run.

Prove it

curl http://127.0.0.1:8080/api/health
curl http://127.0.0.1:8080/api/items

POST a JSON body from curl or a file: not from a Buraaq "..." string ({ interpolates).

Next: REST in depth.