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 Support us

Description

Sample ChatApp backend server written in NestJS for educational purposes

Nest framework TypeScript starter repository.

Installation

$ yarn install

Running the app

NOTE: This app is set to run on port 4200 (instead of conventional 3000).

# development
$ yarn run start

# watch mode
$ yarn run start:dev

# production mode
$ yarn run start:prod

API Documentation

POST /user/login - API to login an existing user

// Request payload
{
  username: string; // try 'sentienta'
  password: string; // try 'asd'
}
// Response payload
{
  authStatus: boolean;
  description: string;
  accessToken: string | undefined;
}

POST /user/signup - API to signup a new user

// Request payload
{
  username: string;
  password: string;
}
// Response payload
{
  status: string; // 'success' | 'failed'
}

POST /message/fetch - API to fetch messages

// Request payload
{
  chatId: string; // value 'main_group_chat' exists in the mock
}
// Request headers
{
  'x-access-token': string; // accessToken fetched from login API
}
// Response payload
{
  messages: {
    author: string;
    message: string;
    timestamp: number;
  }[]
}

POST /message/send - API to send messages

// Request payload
{
  chatId: string; // value 'main_group_chat' exists in the mock
  author: string;
  message: string;
  timestamp: number;
}
// Request headers
{
  'x-access-token': string; // accessToken fetched from login API
}
// Response payload
{
  status: string; // 'success' | 'failed'
}

Test

# unit tests
$ yarn run test

# e2e tests
$ yarn run test:e2e

# test coverage
$ yarn run test:cov

Support

Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.

Stay in touch

License

Nest is MIT licensed.