Skip to content

A Short POC written in NodeJS with GraphQL to "tag" offices into a wishlist

Notifications You must be signed in to change notification settings

orkeren21/holds-nodejs

Repository files navigation

holds-nodejs

A new Holds Service POC written in Node.js

Table of Contents

Intro

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

Setup

  1. Install nvm if you don't have it yet. Follow the instructions here
  2. nvm install 12.6.0
  3. nvm use 12.6.0
  4. npm install

Database

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:

Global Install

  1. npm instal --global sequelize-cli
  2. sequelize db:create
  3. sequelize db:migrate
  4. If you want to undo a migration, run: sequelzie db:migrate:undo

With npx

  1. npx sequelize-cli db:create
  2. npx sequelize-cli db:migrate

Running the Server

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

Sending GraphQL requests

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

About

A Short POC written in NodeJS with GraphQL to "tag" offices into a wishlist

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •