This is an example of Blog API that was built using NestJS, TypeORM and PostgreSQL database to store the blog posts and GraphQL for API endpoints.
The application has the following entities: Blog, BlogPost, User. User have one of two roles: Writer, Moderator.
Link for API & GraphQL Playground
- node version >= 18
The application uses two variable files. .env for the application itself, .env.docker for starting the database using docker. Add these files with the correct values.
You can find examples of variable values in .env.example and .env.docker.example
To install node modules:
$ npm install$ npm run buildStart the database container using docker:
$ docker-compose --env-file=.env.docker up -d # development
$ npm run start
# watch mode
$ npm run start:dev
# production mode
$ npm run start:prod# unit tests
$ npm run test
# test coverage
$ npm run test:cov