kgish / nestjs-jwt-template

A simple NestJS JWT template for getting started

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nestjs API

Description

A simple NestJS JWT template for getting started.

Installation

$ npm install

Database

$ docker-compose up
$ npm run migration:run

Environment

$ cp .env.example .env

Make any necessary changes to the .env file.

Authorization

By default, authorization is enabled. However, this can be disabled by changing the following line in the .env file:

API_AUTH=false

Running the app

In development mode you can simply run the app in watch mode like this:

$ npm run start:dev

The app is now available via the following link:

http://localhost:3000/api/v1

In production:

$ npm run start:prod

Swagger

You can access the swagger docs via the following link:

http://localhost:3000/api/v1/docs/

Note that for the authorization you will have to enter the following value:

Bearer <TOKEN>

Test

# unit tests
$ npm run test

# e2e tests
$ npm run test:e2e

# test coverage
$ npm run test:cov

Migrations

Create a new empty migration:

$ npm run migration:create NameOfMigration

Generate a migration from current schemas:

$ npm run migration:generate NameOfMigration

Run all the migrations:

$ npm run migration:run

References

About

A simple NestJS JWT template for getting started

License:MIT License


Languages

Language:TypeScript 98.2%Language:JavaScript 1.2%Language:Dockerfile 0.4%Language:Shell 0.3%