Nothing Special   »   [go: up one dir, main page]

Skip to content

The generator that acts as the server for games. It starts the game, takes input from players, checks the database for matching input, passes the database entry to the game, and then sends the game's responses to the player.

License

Notifications You must be signed in to change notification settings

aajungroth/fantasy-rpg-generator

Repository files navigation

 ______ ______  __   __  ______ ______  ______  __  __       ______  ______ ______
/\  ___/\  __ \/\ "-.\ \/\__  _/\  __ \/\  ___\/\ \_\ \     /\  == \/\  == /\  ___\
\ \  __\ \  __ \ \ \-.  \/_/\ \\ \  __ \ \___  \ \____ \    \ \  __<\ \  _-\ \ \__ \
 \ \_\  \ \_\ \_\ \_\\"\_\ \ \_\\ \_\ \_\/\_____\/\_____\    \ \_\ \_\ \_\  \ \_____\
  \/_/   \/_/\/_/\/_/ \/_/  \/_/ \/_/\/_/\/_____/\/_____/     \/_/ /_/\/_/   \/_____/

 ______  ______  __   __  ______  ______  ______  ______ ______  ______
/\  ___\/\  ___\/\ "-.\ \/\  ___\/\  == \/\  __ \/\__  _/\  __ \/\  == \
\ \ \__ \ \  __\\ \ \-.  \ \  __\\ \  __<\ \  __ \/_/\ \\ \ \/\ \ \  __<
 \ \_____\ \_____\ \_\\"\_\ \_____\ \_\ \_\ \_\ \_\ \ \_\\ \_____\ \_\ \_\
  \/_____/\/_____/\/_/ \/_/\/_____/\/_/ /_/\/_/\/_/  \/_/ \/_____/\/_/ /_/

version 0.2.0

(Sub-Zero font from http://patorjk.com/software/taag/)

Description

The generator that acts as the server for games. It starts the game, takes input from players, checks the database for matching input, passes the database entry to the game, and then sends the game's responses to the player.

It also maintains public information that players can read to learn more about the game. The database is not for storing save files or player accounts.

A Note About Passwords

<redacted> means that a password has been removed.

The goal of redacting passwords is to prevent this project from ending up on plain text offenders. https://github.com/plaintextoffenders/plaintextoffenders/blob/master/offenders.csv

Supply your own password for the database. Avoid committing it to git in plain text.

Installation

$ yarn install

Running the app

Add this to a .env file in the root of the project directory. This is for Nest.JS so it can connect to the postgres databse.

TYPEORM_TYPE           = "postgres"
TYPEORM_HOST           = "localhost"
TYPEORM_USERNAME       = "postgres"
TYPEORM_PASSWORD       = <redacted>
TYPEORM_DATABASE       = "frg_db"
TYPEORM_PORT           = 5432
TYPEORM_LOGGING        = true
TYPEORM_ENTITIES       = "dist/model/*.entity.js"
TYPEORM_MIGRATIONS_RUN = true
TYPEORM_SYNCHRONIZE    = false

Add this to a ormconfig.json in the root of the project directory. This is for typeORM so it can run migrations against the postgres database.

{
    "type"      : "postgres",
    "host"      : "localhost",
    "port"      : 5432,
    "username"  : "postgres",
    "password"  : <redacted>,
    "database"  : "frg_db",
    "entities"  : ["dist/model/*.entity.js"],
    "migrations": ["dist/migration/*.js"],
    "cli"       : {
      "migrationsDir": "src/migration"
    }
}

When developing, start by running the migration run command and then start the app.

# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod

# Generates a new migration script
$ npm run typeorm:migration:generate -- add_informative_migration_name

# Runs all of the migrations that are not in the migration
$ npm run typeorm:migration:run

# Reverts the most recent migration
$ npm run typeorm:migration:revert"

Starting the postgres docker image with the bash script

./script/start-db.sh <redacted>

Starting the postgres docker image with the docker command

docker run --name local-postgres -p 5432:5432 -e POSTGRES_PASSWORD= -d postgres -rm

Test

# unit tests
$ npm run test

# e2e tests
$ npm run test:e2e

# test coverage
$ npm run test:cov

Nest Logo

A progressive Node.js framework for building efficient and scalable server-side applications, heavily inspired by Angular.

NPM Version Package License NPM Downloads Travis Linux Coverage Gitter Backers on Open Collective Sponsors on Open Collective

Support

Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.

Stay in touch

License

Nest is MIT licensed.

About

The generator that acts as the server for games. It starts the game, takes input from players, checks the database for matching input, passes the database entry to the game, and then sends the game's responses to the player.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published