amwebexpert / amw-hangman-api

Hangman REST API - NestJS implementation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

amw-hangman-api

Hangman REST API using Nest.js

Deployed here: https://amw-hangman-api.herokuapp.com/

Starting the database locally

docker run --name pg-docker --rm -p 5432:5432 -e POSTGRES_PASSWORD=postgres -e POSTGRES_USER=postgres -e POSTGRES_DB=hangman -d postgres

or

docker-compose up -d

or simply

./startDb.sh

Starting the REST API server locally

. ./setEnvDevWorkstation.sh
./startApi.sh

Local links

TODOs

  • add Users and link each category with a user uuid
  • whenever a category or associated text entry is created, modified or deleted, ensure the modifier is the category owner
  • create TextDto for POST and PUT input validations
  • create POST and PUT using TextDto for validations

Add categories and deploy

Adding new categories (initialData)

Since we just add new collections (so far) all the DB tables can be droped and re-created:

  • generate a new migration file: typeorm migration:create src/migration/initialData
  • add the new array into generateInserts.js script and prepare the loop
  • generate the SQL statements into generated-data.txt file: node ./tools/generateInserts.js
  • then copy paste results into the new file for instance 11111111111-initialData.ts

Deploy Heroku repo master branch

  • npm install -g heroku
  • heroku --version
  • heroku login -i
  • execute copyToHerokuStaging.sh
  • ensure to stage new features into heroku repo here: /flutter-projects/heroku-repo/amw-hangman-api
  • git commit -m"feat: my new features"
  • at this point, you can Reset Database on Heroku project admin console:
    • Resources > Heroku Postgres > Datastores > postgresql-solid > Settings
  • git push heroku master
  • heroku logs -t

Nest.js - references - licence

About

Hangman REST API - NestJS implementation

License:MIT License


Languages

Language:HTML 47.2%Language:TypeScript 29.4%Language:JavaScript 23.4%Language:Shell 0.1%Language:Procfile 0.0%