1

GitHub - nhattien015/nest-graphql-typeorm-best-example: Nest + GraphQL + TypeORM...

 1 year ago
source link: https://github.com/nhattien015/nest-graphql-typeorm-best-example
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Nestjs GraphQL TypeORM Best Example

NestJS (GraphQL + Typeorm) codebase containing real world examples.

Introduction

Why should you use this example for Nest + GraphQL + TypeORM ?

  • Scalable
  • Support for both GraphQL and traditional Rest API. You only need create a Controller file for Rest API implementation.
  • Clear Codebase, etc...

Table of Contents

Usage

  1. Clone repository
  git clone https://github.com/nhattien015/nest-graphql-typeorm-best-example.git
  1. Cd into directory
  cd nest-graphql-typeorm-best-example/
  1. Create .env
  >.env
  1. Add to .env
DB_HOST=localhost
DB_PORT=5000
DB_PWD=root
DB_USERNAME=root
DB_DATABASE=nestjs
JWT_ACCESS_TOKEN_SECRET=access_token_secret_key
JWT_ACCESS_TOKEN_EXPIRES_IN=15m
JWT_REFRESH_TOKEN_SECRET=refresh_token_secret_key
JWT_REFRESH_TOKEN_EXPIRES_IN=7d
  1. Install dependencies using npm
  npm install

Starting the Server

  1. Docker ( If use Docker. Run this code, Otherwise setup normally ).
  docker compose up dev-db -d
  1. Sync schema to database
  npm run db:sync
  1. Start in development mode (Default PORT: 3000)
  npm run start:dev

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK