narenarjun / nestjs-explored

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NestJS Explored

Nest Logo

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

Description

Building a simple coffee App with nestjs.

To create a new controller with nestjs cli

nest generate controller

# short form
nest g co

To create a new service with nestjs cli

nest generate service 

# short form
nest g s

Installation

$ yarn install

Running the app

# development
$ yarn run start

# watch mode
$ yarn run start:dev

# production mode
$ yarn run start:prod

Test

# unit tests
$ yarn run test

# e2e tests
$ yarn run test:e2e

# test coverage
$ yarn run test:cov

TypeOrm Module

when connecting to heroku-postgresql from localhost via nestjs TypeOrm module, the connection will be rejected if ssl:true option is not passed and it'll reject connection for self signed certificated too. so, to avoid these issues add ssl rejectUnauthorized to false

{
  "name": "default",
  "type": "postgres",
  "url": "postgres://username:password@host:port/database",
  "synchronize": true,
  "ssl": true,
  "extra": {
    "ssl": {
      "rejectUnauthorized": false
    }
  }
}

About

License:MIT License


Languages

Language:TypeScript 96.6%Language:JavaScript 3.4%