Skip to content

Latest commit

 

History

History
62 lines (43 loc) · 957 Bytes

README.md

File metadata and controls

62 lines (43 loc) · 957 Bytes

workers-rs-tursodb

Updated from the example https://github.com/cloudflare/workers-rs

Todo List

A todo list example featuring Turso and Cloudflare worker.

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 .dev.vars file next to your wrangler.toml:

LIBSQL_CLIENT_URL=
LIBSQL_CLIENT_TOKEN=

Run project

npx wrangler dev

Add a new task:

curl "http://localhost:8787/todos" \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{"task": "Do task m"}'

Get the list of added tasks:

curl "http://localhost:8787/todos"
npx wrangler deploy
curl https://cloudflare-worker-rs-turso.petar-vasilev0727.workers.dev/todos