software-developer-test/backend at master · FrancoMeriles/software-developer-test · GitHub
Skip to content

Latest commit

 

History

History

backend

Folders and files

README.MD

Backend

This Project is a service using nodeJS, ExpressJS and the api from Mercado Libre for a evaluation

Structure

└── docs
│   └── swagger.yml
└── src
│   └── application
│   │   └── controllers
│   │   │   └── items.controller.js
│   │   └── routes
│   │   │   └── items.route.js
│   │   │   └── index.js
│   │   └── dictionaries
│   │   │   └── dictionary.errors.json
│   │   └── app.js
│   └── infrastructure
│   │   └── axios
│   │      └── instance.js
│   │   └── service
│   │      └── items.service.js
│   └── util
│   │   └── getPrice.js
│   └── index.js
└── test
│   └── integration
│   │   └── data
│   │   │   └── itemSuccess.json
│   │   │   └── querySuccess.json
│   │   └── stub
│   │   │   └── getItemData.json
│   │   │   └── getItemDescription.json
│   │   │   └── getQuery.json
│   │   └── items.test.js
│   └── unit
│   │   └── getPrice.test.js
└── .gitignore
└── .eslintrc.json
└── package.json
└── package-lock.json
└── README.MD

How to try it

  • Clone this repo and install all dependencies
npm install
  • Run this project.
npm start

Run

Open the proyect in your localhost port 4000

Routes

Name URL Response
item /api/items/:id Singular item
search /api/items?q=:query Search results items

Linter

In this project i used eslint with the specification of Airbnb, you can run the linter with the following command

npm run lint

Testing

In this project i used Jest for testing, you can run this tests with the following command

Run unit test

npm run test

Run integration test

npm run integration-test

Swagger

To see the swagger, install Swagger Viewer in your Visual Studio Code

  • Open the command pallet with Command+Shift+p and type Preview Swagger
  • Or navigate to this site and paste the docs/swagger.yml in the editor

Dependency check

In this project i used dependency-check for checking which modules i have used in my code and then makes sure they are listed as dependencies in the package.json, or vice-versa

Run dependency-check

npm run dependency-check

Deploy to AWS

This project is ready to deploy using Serverless Framework and Serverless Components in this case i use Express Component

Install the last version of Serverless and deploy 🎉

npm install -g serverless
serverless deploy

Thanks 🙌

  • Franco Meriles