Roman Numeral Server in NodeJS

A simple NodeJS webapp that returns roman numeral value on query.

HTTP Server built using ExpressJS. Roman numeral conversion as per Wikipedia page: Roman numerals.

Yarn for building.

Mocha + Chai for testing.

Prerequisites

  • nodejs
  • yarn

Run server in production

$ NODE_ENV=production # set NODE_ENV=production (in Windows)
$ yarn run start

Run server in development mode

Run server with nodemon to reload server on new changes to the source

$ yarn run dev

For client

$ curl -i "http://127.0.0.1:8080/romannumeral?query={integer}"

Test

$ yarn test

With Docker

Server in prod:

$ docker-compose -f docker-compose.prod.yml up

Server in dev:

$ docker-compose up

Tests:

$ docker-compose run dev-app yarn test

Health-check

$ docker inspect <container-name> --format='{{json .State.Health}}'

Logs, Metrics, Monitoring

Logs printed to host syslog

Metric exposed on localhost:8080/metrics via express-prom-bundle

Monitoring can be added through this exporter by using Prometheus/Grafana