Simple todo list api
First of all is necessary to install all projects dependencies
$ npm install
After that it is necessary to create a .env file, you can just duplicate sample.env and rename it to .env, now, to instantiate a postgres instance is up to you, to facilitate a docker-compose file was created and you can simply run the command bellow to get your postgres up and running
$ docker compose up -d
Now we can just run the migrations so our database schema is up to date
$ npm run typeorm migration:run -- -d data-source.ts
Finally, to run the api just run this command:
$ npm run start:dev
To test the api you can just import the insomnia.json into your insomnia application
- POST /tasks | Create task
- Body schema:
interface CreateTask { name: string; }
- Body schema:
- GET /tasks | List tasks
- GET /tasks/:id | Retrieve task
- Query params schema
interface TasksFilters { page: number = 1; amount: number = 10; }
- Query params schema
- PATCH /tasks/:id | Update task
- Body schema:
interface UpdateTask { name?: string; isComplete?: boolean; }
- Body schema:
- DELETE /tasks/:id | Delete task