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
How to use this template to create a quick HTTP REST server:
npm install -D
conf/config.yaml
with any changes to settings./openapi.yaml
src/controllers/
(Test Driven Development)src/controllers/
src/entry.js
(with other controllers)/api
(or whatever is set in config.yaml)npm run doc
to update the documentationnpm run start-watch
to compile and run server + tests in watch mode
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
TODO
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