Skip to content

littlegubs/vgmq-api

Repository files navigation

VGMQ API

Installation

Start Docker images

$ make start

Install dependencies

$ npm install

Create a .env.local file

Copy the .env file and name it .env.local. This is used to override the variables set in the .env file. It is ignored by Git.

(optional) Retrieve your Twitch access id/secret

While optional, this is useful for instantiating the database with games, and overall import games.

Follow the IGDB documentation to create your account and retrieve your access id and secret.

Then, set these values in their respective variables in .env.local:

TWITCH_CLIENT_ID=YOUR_TWITCH_CLIENT_ID
TWITCH_CLIENT_SECRET=YOUR_TWITCH_CLIENT_SECRET

Instantiate the database

$ npm db:create
$ npm db:update-schema
$ npm db:seed

Running the app

# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod

Accounts

The fake database comes with 5 accounts with the same password: yoyo

database

the database can be seen at http://localhost:8080/ (user: root, password: yoyo)

Updating the database schema

When updating an Entity, TypeORM will not update the database automatically, as it is unsafe to do so. We work with migrations.

for TypeORM to be aware of Entity changes, run:

$ npm run typeorm migration:generate src/migration/whateverTitleYouWant

This command will create a file with the queries necessary to synchronize the database with your Entity.

Once this file is created, run:

$ npm run typeorm migration:run

This will run the queries inside the src/migration/whateverTitleYouWantfile

and you're done!

learn more about migrations here

About

back-end repository of VGMQ, front-end is https://github.com/littlegubs/vgmq

Resources

License

Stars

Watchers

Forks

Sponsor this project

Contributors 4

  •  
  •  
  •  
  •  

Languages