Skip to content
This repository was archived by the owner on Jun 29, 2019. It is now read-only.

Latest commit

 

History

History
101 lines (64 loc) · 3.71 KB

File metadata and controls

101 lines (64 loc) · 3.71 KB

CircleCI Test Coverage Maintainability Greenkeeper badge

Localized GraphQL Koa TypeScript

Example boilerplate for you next GraphQL NodeJs server. Part of the project setup is from petrhanak/backend-typescript-boilerplate.

Demo

You can try the application here (it might take a while before the free server wakes up)

With Multiple Languages 🌍

By default all queries return data in english. If you want to request different translation then you have to send language code in http header:

{
  "language": "cs"
}

If you are not familiar with docker, I highly recommend using it. You can download Docker.dmg here.

All you have to do to run the application in development mode is:

  1. docker-compose up -d
  2. make db-migrate
  3. make db-seed
  4. Open http://localhost:3000/playground in your browser

1

Docker Users

You don't have to install node or postgres or any other library. Development environment is inside docker containers. Makefile is middleman between docker containers and our virtualized application.

NOTE: make sure that CONTAINER_NAME in Makefile has a correct value.

Development:

  • make enter enter container terminal
  • make node_modules reinstall node modules
  • make db-migrate apply database migration
  • make db-rollback rollback database migration
  • make db-reset rollback and migrate
  • make db-seed seed database
  • make dev start development server

Test

  • make test run tests
  • make test-coverage run tests and report coverage

Production:

  • make build build static javascript files

Without Docker

If for some reason you can't or don't want to use docker then following instruction will guide you through the whole installation process:

System Dependencies

  • Install node environment: brew install node
  • Install yarn package manager: brew install yarn
  • Install database brew install PostgreSQL

Commands

Development:

  • yarn install install node modules
  • yarn db:migrate apply database migration
  • yarn db:rollback rollback database migration
  • yarn db:reset rollback and migrate
  • yarn db:seed seed database
  • yarn dev start development server

Test

  • yarn test run tests
  • yarn test:coverage run tests and report coverage

Production:

  • yarn build build static javascript files

Database

Use these commands to control PostgreSQL service:

  1. $ brew services start PostgreSQL
  2. $ brew services stop PostgreSQL
  3. $ brew services restart PostgreSQL

Troubleshooting

Error: connect ECONNREFUSED 127.0.0.1:5432

If PostgreSQL stops working for no particular reason, run: rm /usr/local/var/postgres/postmaster.pid you can find more information here