Notes API
A small JSON API with a database, built with Hono. Start here for any backend: add your routes next to the notes ones.
Get it
$ npx dukoi init notes-api It makes a notes-api folder and deploys it. On the phone instead: Try a template → Notes API → Deploy.
What you get
Open the URL and the API tells you what it can do. Notes are saved in DATA_DIR, so they survive deploys and rollbacks.
{
"name": "notes-api",
"routes": {
"GET /notes": "List notes",
"POST /notes": "Add a note",
"DELETE /notes/:id": "Remove a note"
}
}Make it yours
Three files. You only need to touch one.
- server.js
- The routes. Edit this one.
- package.json
- Its name and packages
- README.md
- How to run it, in five minutes
Add a route to server.js:
// Count the notes
app.get('/notes/count', (c) =>
c.json(db.prepare('SELECT count(*) AS n FROM notes').get()),
) Then deploy again. It’s live in seconds, and your notes are still there.
$ npx dukoi deploy