Skip to content

Latest commit

 

History

History
110 lines (69 loc) · 2.76 KB

README.md

File metadata and controls

110 lines (69 loc) · 2.76 KB

Fastify TypeScript Postgres DockerPrisma

API: TO - DO

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.

How to run locally?

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.

API documentation

You can use the insomnia-schema.json file to have the collection of requests in your hands at once.

Return All Tasks

  GET /:size/:page
Parameter Type Description
size number Required. Number of records you want to return
page number Required. Page number

Create a Task

  POST /
Parameter Type Description
Name string Required. Task name

Update a Task

  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)

Deletes a task

  DELETE /
Parameter Type Description
ID number Required. Task identification

Author