This project was inspired by the challenge Pontos de Interesse presented in the backend-br/desafios repo. The challenge consists in the following:
1- must receive a request with a 'point of interest' payload and save it to the database. 2- must return all the points inside the database. 3- when receiving request with point position and a distance, should return only the points that are inside the distance.
{
"name": "Point of interest",
"x": 10,
"y": 12
}
Method | Route | Description |
---|---|---|
POST | /points | save a point of interest |
GET | /points | get all points of interest |
GET | /points?x=4&y=7&d=15 | get all points of interest inside a distance |
Create a .env file with the following variables:
DATABASE_URL=mongodb://localhost/test
Then run the following command:
- Run
npm install
- Run
npm start
ornpm run start:dev
to run the server in development mode - Run
npm run test
to run the tests