This is the API behind sparrow-cli which lets you track daily completed tasks/goals in a D1 database.
- Sign up for Cloudflare Workers. The free tier is more than enough for most use cases.
- Clone this project and install dependencies with
npm install
- Run
wrangler login
to login to your Cloudflare account in wrangler - Run
wrangler deploy
to publish the API to Cloudflare Workers
- Your main router is defined in
src/index.ts
. - Each endpoint has its own file in
src/endpoints/
.
- Run
wrangler dev
to start a local instance of the API. - Open
http://localhost:9000/
in your browser to see the Swagger interface where you can try the endpoints. - Changes made in the
src/
folder will automatically trigger the server to reload, you only need to refresh the Swagger interface.
To add authentication to your project, simply generate a random token and add it to your wrangler.toml file like so
[vars]
AUTH_TOKEN = "test-xxx"