Skip to content

moj124/chat-backend

Repository files navigation

Nest Logo

A progressive Node.js framework for building efficient and scalable server-side applications.

NPM Version Package License NPM Downloads CircleCI Coverage Discord Backers on Open Collective Sponsors on Open Collective Donate us Support us Follow us on Twitter

Description

Nest framework TypeScript Chat Backend application.

Endpoints

GET users/

Description:

  • Get all users.

GET users/:id

Description:

  • Get user by ID in parameters.

POST users/register

Description:

  • Create a user with a given body.

Body:

  • {username: string, password: string,firstname: string,lastname: string}

POST users/remove/:id

Description:

  • Delete the specified :id user from the Database.

POST users/login

Description:

  • Add JWT token to cookie and return user upon successful authentication with body.

Body:

  • {username: string, password: string}

Installation

$ npm install

Running the app

# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod

Test

# unit tests
$ npm run test

# e2e tests
$ npm run test:e2e

# test coverage
$ npm run test:cov

TypeORM Migrations

Generate migration file

npx typeorm-ts-node-commonjs migration:generate ./src/database/migrations/nameDescription -d ./src/database/dataSource.ts

Run migration

npx typeorm-ts-node-commonjs migration:run -d ./src/database/dataSource.ts

Revert migration

npx typeorm-ts-node-commonjs migration:revert -d ./src/database/dataSource.ts

License

MIT licensed.