A progressive Node.js framework for building efficient and scalable server-side applications.
Step by step guidance to install and run the API
$ npm install
This API runs on a MySQL Database - the syntax for MySQL database URL is:
mysql://<user>:<password>@localhost:3306/<database-name>
First generate the database tables by running the command
$ npm run prisma:migrate
Then deploy the database for development or test purposes
$ npm run prisma:deploy:dev or npm run prisma:deploy:test
# development
$ npm run start
# watch mode
$ npm run start:dev
# production mode
$ npm run start:prod
# unit tests
$ npm run test
# e2e tests
$ npm run test:e2e
# test coverage
$ npm run test:cov
This project requires some environment variables in order to function - The app will not work without these variables, please populate them accordingly
These variables should be set in a '.env' file at the source of the project, and in a '.env.test' file for test-related environment variables
Below, an example of these variables:
# MySQL database URL with correct syntax
DATABASE_URL="mysql://<user>:<password>@localhost:3306/<database>"
# Key used to hash Jwt
JWT_KEY="<secret-key>"
# Possible values: "error", "warn", "info", "debug"
LOGGER_LEVEL="<value>"
Returns the information about the current user
# GET
# JWT-PROTECTED
users/me
Returns the information about the user corresponding to the 'id' param
# GET
# JWT-PROTECTED
# @Param - id: string
users/:id
Updates the User corresponding to the 'id' param, returns the updated user data including a new token
# PATCH
# JWT-PROTECTED
# @Param - id: string
# @Body - (optional params) {email: string, firstName: string, lastName: string, password: string}
users/:id
Creates a user in the database and returns a jwt token
# POST
# @Param - {email: string, firstName: string, lastName: string, password: string}
auth/signup
Logs in a user and returns a jwt token if email & password are correct
# POST
# @Param - {email: string, password: string}
auth/login
Returns the information about the product corresponding to the @id param, id representing the product's bar code | Cached for 5 minutes with key: 'offApiCalls - id'
# GET
# JWT-PROTECTED
# @Param - {id: string}
products/:id
Nest is [MIT licensed].