JWT Authentication in Node.js

This is a simple JWT authentication microservice made with Node.js + Express.

Technologies  |  Configuration  |  Other commands

💻 Technologies

Main technologies used:

⚙️ Configuration

1. First of all, you need to create/have a PostgreSQL database.

2. Then, in /.env make sure the PostgreSQL variables are the same you use to connect to your database.

3. To install all project dependencies:

$ npm install

or using Yarn:

$ yarn

4. To init database, creating the users table:

$ npm run typeorm-migration

or using Yarn:

$ yarn typeorm-migration

5. Finally, to run:

$ npm run dev

or using Yarn:

$ yarn dev

🧐 Other commands

To build the project for production:

$ npm run build

or using Yarn:

$ yarn build

To serve in production (it needs to be built first):

1. In /.env switch NODE_ENV from "development" to "production".

2. Then, run in production by the following command:

$ npm run start

or using Yarn:

$ yarn start

To test the controllers:

1. First of all, you need to create/have another PostgreSQL database for testing.

2. Then, in /.env make sure the PostgreSQL variables are the same you use to connect to your testing database.

3. Finally, to run the tests:

$ npm run test

or using Yarn:

$ yarn test