GithubHelp home page GithubHelp logo

nodejs2023q2-service's Introduction

Home Library Service

Prerequisites

Downloading

git clone {repository URL}

go to the copied folder, in your terminal and complete next command:

cd nodejs2023Q2-service
git checkout HLS-3

Installing NPM modules

npm install

Running application

  • Create .env file (based on .env.example) in copied folder: ./.env

    • logging level stored in LOG_LEVELS environment variable (Note: valid logging level 0 <= n <= 4, default: 4)
    • Max file size stored in MAX_FILE_SIZE environment variable, the value is specified in kB, default: 48
  • Run next command in your terminal, for building images and docker containers up:

docker-compose up -d
  • App logs are written in the ./logs:/usr/app/logs volume (./logs dir in app root)

After docker compose command complete and dockers starting you can open in your browser OpenAPI documentation by typing http://localhost:4000/doc/ (port 4000 as default) and execute test queries.

Testing

After application running in dockers open new terminal in your host machine and enter:

To run all tests with authorization

npm run test:auth

To run only one of all test suites

npm run test:auth -- <path to suite>

Vulnerabilities scanning

npm run docker:scan

Migrations

Migrations execute automatically when docker-compose command complete and create database entities.

If you want to migrate manually you can execute next command in your terminal:

rm -rf ./prisma/migrations
npx prisma migrate dev --name my-custom-migrate

Auto-fix and format

npm run lint
npm run format

Work with Swagger (OpenAPI)

Swagger (OpenAPI)

  • link for server: http://localhost:4000/doc

  • All endpoints (except auth/signup, auth/login, /doc and /) are protected with JWT authentication. You should provide JWT token in Authorization: Bearer <jwt_token> request header, but for auth/refresh route you should provide JWT refresh token in request body:

{refreshToken: 'your_token'}
  1. Sign Up via auth/signup. (Note: Login is unique field in db, and you can create only one user with such login.)
  2. Login with your login and password and get tokens via auth/login
  3. Press Authorize button and use your accessToken

Debugging in VSCode

Press F5 to debug.

For more information, visit: https://code.visualstudio.com/docs/editor/debugging

nodejs2023q2-service's People

Contributors

sekaa4 avatar thorsangervanet 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.