Download the example or clone the repo:
git clone git@github.com:paramsinghvc/nestjs-graphql-demo.git
cd nestjs-graphql-demo
cd server
- Install Postgres and create a user and a database named demo.
- Configure the username, password, database name in
src/app.module.ts
TypeOrmModule.forRoot({
type: 'postgres',
host: 'localhost',
port: 5432,
username: 'user',
password: '',
// more options...
}),
- Install Node modules and run:
yarn # or npm install
yarn start:debug # or npm run start:debug
The server will be started on port 3001 🚀. Port can be configured in src/main.ts
Navigate to http://localhost:3001/graphql
in the browser to see the graphql schema.
cd ../client
Install Node modules and run:
yarn # or npm install
yarn dev # or npm run dev
The app will start on port 3000. The port can be configured using -p
flag.