xinnks / embedded-replicas-with-nodejs

A simple honojs recipe API using Turso embedded replicas

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Embedded replicas with NodeJs

A recipe book CRUD API featuring Turso embedded replicas and HonoJs.

Pre-requisites

Development

Create a turso database.

turso db create <db-name>

Get the database credentials:

# db url
turso db show --url <db-name>

# authentication token
turso db tokens create <db-name>

Store the credentials inside a .env file:

TURSO_DATABASE_URL
TURSO_AUTH_TOKEN

Install project dependencies:

npm i

Run project

In development:

npm run dev

In production:

npm run start

Send requests

Add a new task:

curl "http://127.0.0.1:8080/todos" \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{ "recipe": { "name": "Recipe 1", "nutritionInformation": "Vitamin A, Vitamin B", "instructions": "Do abc" }, "ingredients": [{ "name": "ingredient 1", "measurements": "2 cups" }] }'

Get the list of added tasks:

curl "http://127.0.0.1:8080/todos"

About

A simple honojs recipe API using Turso embedded replicas

License:MIT License


Languages

Language:TypeScript 92.7%Language:Dockerfile 7.3%