/vinos-back

Primary LanguageJavaScript

Vinos

Purpose

The aim of this wine-exercise is to build a small wine app, as part of a University Web apps and sites development Master by Universitat Oberta de Catalunya.
Subject: Front-end with frameworks JS I. June 2021.
This is a simple back-end application for this other project.

Endpoints

wine routes

route method action
/api/wine/ get returns a list of all wines
/api/wine/ post creates a new wine with the object attached to request.body
/api/wine/:id get returns a wine with the given id
/api/wine/:id patch updates the quantityInCart field of a wine with a given id
/api/wine/:id delete deletes a wine with a given id
/api/wine/year/:name get returns all wines of a given year, format YYYY
/api/wine/rating/:value get returns all wines of a given rating (1 to 5), format integer
/api/wine/grapes/:name get returns all wines with a given grapes type
/api/wine/region/:name get returns all wines of a given region
/api/wine/country/:name get returns all wines of a given country

user routes

route method action
/api/user/login post signs in a user with a given token
/api/user/register post signs up a user with a given token

Repo

A Git repository can be found in this Github repo.

Tech stack

Quality gate

Mocha: 20 tests passed | 54.24% lines coverage
Sonarqube: 0 bugs | 0 code smells | 0 vulnerabilities | 0 security hotspots | 0% code duplication (excluding duplicated API file requested to separate deliverables) \

Development server

Server opens at http://localhost:3010/.

Running unit tests

command action
npm run test run all tests and generate coverage report
npm run test-watch run all tests and watch for changes
npm run test-single [yourTestFile] run a single test file
npm run test-single-watch [yourTestFile] run a single test file and watch for changes
npm run test-clean removes all coverage report files and directories

Credits

Assistant professor Carlos Caballero

Author

Francesc Brugarolas, repo

June 2021