Skip to content

anstiriab/blog-api

Repository files navigation

Blog API

Description

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

Postman collection

Running the app:

Requirements:

  • node version >= 18

Environment variables

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

Installation

To install node modules:

$ npm install

Build the app

$ npm run build

Database

Start the database container using docker:

$ docker-compose --env-file=.env.docker up -d 

Running

# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod

Test

# unit tests
$ npm run test

# test coverage
$ npm run test:cov

About

example of a Blog API built using NestJS, TypeORM, and GraphQL

Topics

Resources

Stars

Watchers

Forks

Languages