A progressive Node.js framework for building efficient and scalable server-side applications.
Try to fix bugs:
- ✔️ client side fetch graphql api
- ❌ server side(SSG) FAIL to fetch graphql api
- ❌ postman FAIL to fetch graphql api
Follow ./env/example.env to define env variables. Make sure you have .env
, developmnet.env
and production.env
files set up.
Also, mongo db have different URI format by version. Our .env
is following the second one. See more on config.service.ts
# 1. mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]
# 2. mongodb+srv://[username:password@]host[/[database][?options]]
In GraphQL Playground add the http header as below, when testing protected GQL query / mutation, which is only accesible after authentication
{
"Authorization" : "Bearer <encodedJWT>"
}
- Crash Course - First taste
- Crash Course - w/ MongoDB
- Crash Course - mongoose -- my notes
- Crash Course - Authentication
notion | note |
---|---|
module | |
ㄴ Contorller | handling incoming requests and returning responses |
ㄴ Provider | service you provide, called by controller |
ㄴ Model | as a class property |
ㄴ ❓imports | |
❓Interceptors | @injectable() |
- Write method in
Controller
(.controller.ts) 🡪What
's the req and res - Write method in
Provider
(.service.ts) 🡪How
to impliment the logic like how to process datas from db and return them.
- Decorator Factory -- when use, pass in para
@Logger('hi')
, which return decorator categorized as below 4- Class decorator
- Method decorator
- Property decorator
- Parameter decorator
- Auth: JWT and base64
- Auth: Session and Cookie and passport.js
- DTO: Graphql and class-validator.js
- Mongo: aggregate
$ npm install
# development
$ npm run start
# watch mode
$ npm run start:dev
# production mode
$ npm run start:prod
# unit tests
$ npm run test
# e2e tests
$ npm run test:e2e
# test coverage
$ npm run test:cov