This is a template GraphQL/TypeORM/PostgresSQL API. The application uses docker-compose in development and can be deployed with Kubernetes in production.
- Define any additional development variables inside a
.env.development
file. By default, the.env.development
file doesn't require any variables, but it must exist. - Install your dependencies locally:
npm install
- You can start up the server with the
./dock dev start
by using the supplied bash script. Alternatively, run thedocker-compose
command by hand:PORT=1451 docker-compose -f docker-compose.dev.yml up
which will run your API locally, and expose it onhttp://localhost:1451/graphql
- Define any additional variables inside a
.env.test
file. By default, the.env.test
file doesn't require any variables, but it must exist. - Run tests with the
./dock test start
command, or run thedocker-compose
command by hand:docker-compose -f docker-compose.test.yml run --rm api_test
This application is designed to be run through kubernetes. The configuration files are stored inside the infrastructure
folder. There is a separate readme for configuring your cluster contained in that folder.
- Install in the container
docker exec typeorm-api npm install PACKAGE_NAMES
- Install the packages locally with
npm install
(no need to specify the packages, because they will get picked up in your package.json file)
Note that you will have to exec
install in your test container for the packages to be used there as well. Yes, this is clunkier than volume mounting. But the danger there is that you install a binary on your local machine (windows/mac) which won't work in the container.
Use the ./dock dev logs
command to follow the logs in development (they'll be hidden if you start your development server with the --detached
flag).