Code Monkey home page Code Monkey logo

node-rest-project's Introduction

๐Ÿค– node-rest-project

M2 Back-end REST project

๐Ÿš€ How to run the app

Requirements

To run the app, you must have Docker ๐Ÿณ , Docker Compose and Node.js installed on your machine.

Installation

To install, open a terminal at the root of the project and run:

npm install

The .env file should follow the .env.safe file format

For testing purposes you can use dumb data as:

DATABASE_HOST=localhost
DATABASE_USERNAME=db_user
DATABASE_PASSWORD=db_password
DATABASE_NAME=node_app_db
DATABASE_PORT=5432

โš ๏ธ Obviously this data would be secret in real life.

Running the app

  1. First, open a terminal at the root of the project, and run:
docker-compose up
  1. Second, still at the root of the project, run this command to build the project:
npm run build
  1. Then make the migration of the database with this command:
npm run migration:run
  1. To populate the database run:
  • on MacOS/Linux bash scripts/populate-db.sh
  • on Windows ./scripts/populate-db.ps1

To reset the database (drop all table):

  • on MacOS/Linux bash scripts/reset-db.sh
  • Windows ./scripts/reset-db.ps1

To remove all the data without droping tables:

  • on MacOS/Linux bash scripts/clear-db.sh
  • Windows ./scripts/clear-db.ps1
  1. Finally, in the same terminal, run this command to start:
npm run start

๐Ÿงช How to run the tests

This project comes with unit tests, which can be found in the tests directory at the root of this project. These tests are written using Jest.

Running the tests

Without coverage

To run the tests without coverage reports, open a terminal at the root of this project and run:

npm run test

With coverage

To run the tests and generate a coverage report, open a terminal at the root of this project and run:

npm run test:coverage

The script will run the tests and generate a code coverage report (visible in the command line). Since Jest has Istanbul built in, an HTML version of the coverage report will also be available here after the script's execution.

This project uses Swagger to generate documentation for each endpoint. Once the app is running, the documentation is available at this address (http://localhost:7000/docs).

๐Ÿ‘จโ€๐Ÿซ Checkpoints

See the full checkpoints file here.

node-rest-project's People

Contributors

cvbenur avatar eldondanonino avatar mr-monster-0248 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.