Skip to content

Video Game Blog API built in Nest.js, Postgres, TypeORM

License

Notifications You must be signed in to change notification settings

rostgoat/ea-blog-api

Repository files navigation

circleci npm npm

Overview

Game Bible is a video game blog application created to experiment with various features of the Nest.js framework. This repository features the Nest architecture patterns using Modules, TypeORM setup for PostgreSQL and Unit/Integration testing with Jest.

Getting Started

Prerequisites

The following must be installed to run the application

Node v13.10.1
npm 6.14.3

Environment Variables

The following environment variables need to be set in you .rc file:

DATABASE_HOST=localhost
DATABASE_PORT=5432
DATABASE_NAME=gamebible_dev
DATABASE_USERNAME=rm
DATABASE_PASSWORD=root

SECRETKEY=somereallylongtoken
EXPIRESIN=1d

The above is my .zshrc file. The username and password variables corralate to the postgres user I created locally in my database.

Database setup

Before the application can be run locally, a working version of PostgreSQL must be installed on your OS.

Creating a user in PostgreSQL just like the one I have:

CREATE ROLE rm WITH PASSWORD 'root';
ALTER ROLE rm WITH LOGIN;
ALTER ROLE rm WITH CREATEDB;
ALTER ROLE rm WITH SUPERUSER;

After you have installed PostgreSQL, run the following commands in the pg terminal:

  1. CREATE database IF NOT EXISTS gamebible_dev
  2. \c gamebible_dev
  3. CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
  4. CREATE EXTENSION "pgcrypto";

or

npm run drop-db:local

Running

  1. npm install
  2. npm run start:dev

Testing

To run all tests:

npm run test

Docs

Swagger is the main engine behind our documentation. To view the docs:

Launch Node Server

npm start

View All

http://localhost:3000/api

View Specific Model

You can view methods individually by appending a parameter to the end url

View Users Model

http://localhost:3000/api/users

Schema

Alt

License

MIT

About

Video Game Blog API built in Nest.js, Postgres, TypeORM

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published