Home Manual Reference Source Test API Healthcheck

version: 0.7.0-SNAPSHOT

Template Webpack REST Server

GitHub License FOSSA Status
GitHub last commit GitHub Workflow Status
Dependency Check by David Dev Dependency Check by David
ESDoc Status CII Best Practices Summary OpenAPI/Swagger Validator
GitHub issues GitHub issues by-label


Template and Example using Webpack for rapid development of an REST API server with endpoints for managing requests and connections to other servers and/or database/storage tools.

This example can also be used to quickly create a server with your own endpoints to do whatever you would like on any requests (either user/interaction based, or with a cron job to make it on a scheduled basis)


Node v10+ and npm (tested with v10.15.1)

See package.json(github) for full list of current dependencies

Quick Setup/Run

How to use this template to create a quick HTTP REST server:

  1. Download and update node + dependencies
  2. Update conf/config.yaml with any changes to settings
  3. Add endpoint definitions to OpenAPI config in ./openapi.yaml
  4. Add Unit tests in src/controllers/ (Test Driven Development)
  5. Add Controller Files to src/controllers/
    • For now, add reference to controller in src/entry.js (with other controllers)
    • Controller endpoints will be served at /api (or whatever is set in config.yaml)
  6. Run npm run doc to update the documentation
  7. Run npm run start-watch to compile and run server + tests in watch mode

NPM Commands for Testing/Running

npm run start-watch to run open the server and run Webpack to watch for changes, recompiling, running the tests and restarting the server when it is done

npm run test-watch to run Mocha and with all tests associated with the project, watch for changes on the files to re-run the tests

npm run dev-watch to run only webpack to watch for changes on the files and recompile/rerun tests

npm run test to run all of the unit tests for the application one time

npm run dev to run a development version of the server

npm run build to compile development version of server to dist/

npm run doc to generate static documentation in the doc folder

npm run lint to run linter and see any errors/warnings

npm run clean clean the workspace (remove dist/)

npm run help to print the contents of help.txt to the command line


npm run build-prod ... TODO: compile application to production version

npm start .. TODO: start production Server

npm stop .. TODO: stop production Server

npm restart will restart once start/stop completed