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.
The following must be installed to run the application
Node v13.10.1
npm 6.14.3
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.
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:
CREATE database IF NOT EXISTS gamebible_dev
\c gamebible_dev
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
CREATE EXTENSION "pgcrypto";
or
npm run drop-db:local
npm install
npm run start:dev
To run all tests:
npm run test
Swagger is the main engine behind our documentation. To view the docs:
npm start
http://localhost:3000/api
You can view methods individually by appending a parameter to the end url
http://localhost:3000/api/users