All instructions are for MacOS / Homebrew, but feel free to use whichever installation methods you would prefer.
-
Install
justbrew install just
-
Install
pnpmcorepack enable pnpm # if you use corepack # or npm i -g pnpm # if you don't care for version management
-
Install Postgres (Postgres.app is the easiest to use on MacOS)
brew install --cask postgres-unofficial
-
Install
migratebrew install golang-migrate # or use the shell install (works on all platforms) curl -L https://github.com/golang-migrate/migrate/releases/download/$version/migrate.$os-$arch.tar.gz | tar xvz
-
Copy
.env.exampleto.envand fill it out -
If you haven't yet, create the database then run:
just migrate up
-
Run the dev server:
pnpm run dev
-
Get all todos
curl -L 'localhost:3000/api/todo' -
Get todo by ID
curl -L 'localhost:3000/api/todo/1' # replace the 1 with the todo ID you would like to fetch
-
Create todo (invalid request body)
curl -L 'localhost:3000/api/todo' \ -H 'Content-Type: application/json' \ -d '{}'
-
Create todo (valid request body)
curl -L 'localhost:3000/api/todo' \ -H 'Content-Type: application/json' \ -d '{ "name": "TodoNow", "description": "can be undefined" }'
-
Toggle todo
curl -L -g -X POST 'localhost:3000/api/todo/1/toggle' # replace the 1 with the todo ID you would like to toggle