API in Fastify, Postgres and Docker. Responsible for task management (CRUD).
This is a simple project, intended to demonstrate a basic CRUD, without business rules.
Clone this project
git clone https://github.com/itallonet/api-todo
Enter the project directory
cd api-todo
Run docker (to upload the database)
docker compose up -d
Install dependencies
npm install
Perform database configuration with Prisma
npx prisma generate
If you face any problem then run this
npx prisma migrate dev --name init
Start the server
npm run dev
Now, use the URL http://localhost:9140 according to the documentation.
You can use the insomnia-schema.json file to have the collection of requests in your hands at once.
GET /:size/:page
Parameter | Type | Description |
---|---|---|
size |
number |
Required. Number of records you want to return |
page |
number |
Required. Page number |
POST /
Parameter | Type | Description |
---|---|---|
Name |
string |
Required. Task name |
PUT /
Parameter | Type | Description |
---|---|---|
ID |
number |
Required. Task identification |
Name |
string |
Required. Task name |
Done |
boolean |
Required. Identifies whether the task was completed (True) or not (False) |
DELETE /
Parameter | Type | Description |
---|---|---|
ID |
number |
Required. Task identification |