A new Holds Service POC written in Node.js
This is a POC application for a new Holds WebService. It is part of an experiment to see which technological stack fits our needs the most
We have chosen two different stacks to test. This was done via a democratic poll in the #stl-holds-language
slack channel whereby three teams voted for their top two preferred languages
from a pool of four: NodeJS, Kotlin, Elixir, Go
.
The top two voted were NodeJS
and Elixir
. You can see the Elixir
repository here
- Install
nvm
if you don't have it yet. Follow the instructions here nvm install 12.6.0
nvm use 12.6.0
npm install
You must have a postgres database server up and running in order to use the service.
This project uses sequelize as an ORM and migration manager.
In order to run migrations and db operations you need to install sequelize-cli
as a global module OR if you don't want to install anything you can run it via npx
:
npm instal --global sequelize-cli
sequelize db:create
sequelize db:migrate
- If you want to undo a migration, run:
sequelzie db:migrate:undo
npx sequelize-cli db:create
npx sequelize-cli db:migrate
The package.json
file has several scripts:
- To run the server in "development" mode (uses nodemon) run
npm run-script dev
- To run the server in "production" mode (uses pm2) run
npm start
- To run the tests, run
npm test
- The server runs on
localhost:4000/graphql
Postman now supports Graphql queries. So you can use that as a standalone application to test the server
The server utilizes apollo-server which has a built-in graphql playgorund for you to use with the server.
Note that the playground DOES not work when NODE_ENV=production