API developed for the purpose of testing my technical knowledge in back-end development.
The goal is to develop an API in Node.JS with endpoints for Creating, Reading, Editing and Deleting information in the user table. As a bonus, create an endpoint that returns the user's location according to the registered address.
$ git clone https://github.com/pedrolucasD/node-backend-test.git
$ cd node-backend-test
$ npm i
NODE_ENV=development
PORT=8080
API_KEY=e11ca31f-fb8c-4579-b6a7-fc20f8a50039
GOOGLE_API_URL='https://maps.googleapis.com/maps/api/geocode/json'
GOOGLE_API_KEY=
require('dotenv').config();
module.exports = {
development: {
database: 'databaseName',
username: 'userName',
password: 'userPassword',
dialect: 'dialect',
port: DBPort,
host: 'yourHost',
dialectOptions: {
decimalNumbers: true
}
}
}
npx sequelize db:migrate
npx sequelize db:seed:all
$ npm run dev
The server will run on the port set into .env file
With the server running, access the Swagger documentation that contains all the details of the existing endpoints and the tests.
http://localhost:8080/docs
On the left side of the Swagger interface (http://localhost:8080/docs) there will be an authorization button where the API-KEY must be inserted. Any value can be inserted.
Pedro Soares