/NestJS-sample

Primary LanguageTypeScript

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

Nest framework TypeScript starter repository.

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

Here are some notes on this project.

Install NestJS CLI

This project, please use NestJS v8.x for use DB library.

Run following command.

$ npm i -g @nestjs/cli@8.2.8

Install TypeORM with PostgreSQL Driver

$ npm install --save typeorm@0.2.45 @nestjs/typeorm@8.0.2 pg

Attention : typeorm v0.3 is unrecommended.

Execute migration(TypeORM)

First, execute migration:generate command(hoge.ts) for create migration file. Next, npm run start to compile typescript file to javascript file. Finally, execute migration:run command.

# Create migration file.
$ npx typeorm migration:generate -n 'migration-file-name'

# Execute migration(SQL).
$ npx typeorm migration:run

PostgreSQL and pgAdmin setting

For use docker compose, install Docker Desktop, and run following command.

$ docker-compose up -d

After starting Docker, access http://localhost:81 and type username and password.


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.