This project is a NodeJS REST API developed for a CRUD of states
Follow this instructions to get a copy of this project in your local env to develop and test.
To run the project you will need:
Clone this repo:
git clone [email protected]:pcrodrigues0/crud-states.git
cd crud-states
Is recommended to user Yarn. To install it:
npm install -g yarn
Then, install projects dependencies:
yarn
After config, to run application:
docker-compose up
yarn start
You can access the API of States by the following routes:
Method | Route | Description | Body |
---|---|---|---|
POST | /api/states | Add a new state on DB | name, uf |
GET | /api/states | Get all states on DB | none |
GET | /api/states/:uf | Get states of this UF | none |
PUT | /api/states/:id | Update the state | name, uf |
DEL | /api/states/:id | Delete the state |
You can access the API of Cities by the following routes:
Method | Route | Description | Body |
---|---|---|---|
POST | /api/cities | Add a new city on DB | name, stateId |
GET | /api/cities | Get all cities on DB | none |
GET | /api/cities/:name | Get city by name | none |
GET | /api/cities/stateid/:id | Get city by stateId | none |
PUT | /api/cities/:id | Update the passed city | name, stateId |
DEL | /api/cities/:id | Delete the city |