The project consists of a REST API for creating, reading, updating, and deleting "To dos".
- Node.js
- Express
- TypeScript
- PostgreSQL
- Sequelize
Clone this repository:
$ git clone https://github.com/luc-ribeiro/nodets-todo-api.gitInstall the dependencies:
# with npm
$ npm install
# with yarn
$ yarn installCreate a .env file at the root of the project
In this file, define the following settings:
PORT=PortNumberWhereTheApplicationWillRun
PG_DB=DatabaseName
PG_USER=DatabaseUserName
PG_PASSWORD=UserPassword
PG_PORT=DatabasePortNumberCreate a table in the Database named todos
Run the command:
# with npm
$ npm run start-dev
# with yarn
$ yarn start-devAfter defining the port number in the .env file:
GET localhost:PortNumber/todo → Lists the To Dos registered in the Database.
POST localhost:PortNumber/todo → Registers a To Do, you need to inform the title in the request Body, which will be the name of the To Do.
PUT localhost:PortNumber/todo/:id → Updates the To Do with the informed ID. It is necessary to inform the title in the request Body.
DELETE localhost:PortNumber/todo/:id → Deletes the To Do with the informed ID.

