Skip to content

Latest commit

 

History

History
89 lines (66 loc) · 4.16 KB

README.md

File metadata and controls

89 lines (66 loc) · 4.16 KB

Server

Heroku

Install

  1. Download and install LTS Node.js
  2. Download, install and run MongoDB 4.4.3 or higher
    1. Or you can use MongoDB Atlas.
  3. Move to server directory (if you are in the root directory)
cd server
  1. Install dependencies
npm i # or yarn
  1. Set your custom environment variables (copy example env)
cp .env.example .env
  1. Run seeding migrations
npm run migrate:up # or yarn migrate:up
  1. Start dev version
npm run dev # or yarn dev

If you would like see production version

Set NODE_ENV=production

npm run start # or yarn start

Test

You can run integration API tests

npm run test # or yarn test

Main libraries

  1. express is a minimal and flexible Node.js web application framework.
  2. nodemon is a utility for monitoring any changes in your source and automatically restarting your server.
  3. dotenv is a zero-dependency module that loads environment variables. It uses The Twelve-Factor App methodology.
  4. body-parser is Node.js body parsing middleware.
  5. mongoose provides a straight-forward, schema-based solution to model your application data. It includes built-in type casting, validation, query building, business logic hooks and more, out of the box.
  6. yup is a schema builder for runtime value parsing and validation.

Code linting

  1. eslint (with airbnb) is statically code analyzer.

Migrations

  1. migrate-mongo is a database migration tool for MongoDB running in Node.js.
  2. faker - generate massive amounts of fake data in the browser and node.js. But now you need to use this correct version - 5.5.3.

Testing libraries

  1. jest is JavaScript Testing Framework.
  2. supertest. HTTP assertions made easy via superagent.
  3. coveralls can get the great coverage reporting.

API documentation

  1. swagger-ui-express. This module allows you to serve auto-generated swagger-ui generated API docs from express, based on a swagger.json file. The result is living documentation for your API hosted from your API server via a route.
  2. swagger-jsdoc. This library reads your JSDoc-annotated source code and generates an OpenAPI (Swagger) specification.

Security issues

  1. cors is a node.js package for providing a Connect/Express middleware that can be used to enable CORS with various options.
  2. helmet helps you secure your Express apps by setting various HTTP headers.
  3. xss-clean is a middleware to sanitize user input coming from POST body, GET queries, and url params.
  4. express-mongo-sanitize is a middleware which sanitizes user-supplied data to prevent MongoDB Operator Injection.
  5. eslint-plugin-security is ESLint rules for Node Security.

Extra libraries

  1. winston is designed to be a simple and universal logging library with support for multiple transports.
  2. morgan is HTTP request logger middleware for node.js
  3. yup-phone is yup phone validator using google-libphonenumber.
  4. http-status is a utility to interact with HTTP status codes.