Multiple Express Server Scaffold
17 July 2014
I recently needed to create a demo of an OAuth2 workflow. This required four servers in total, most with ssl, all running concurrently. The trick was to actually develop this system within my workflow.
By bringing together the various plugins and writing a configurable base express app, I was able to make a scaffold capable of supporting multiple servers, creating ssl certificates on the fly, and loading middleware, routers, and routes dynamically.
- Copy the
/app
template and paste it to a sibling folder - Change the
config.json
entry to match your new folder - Make any changes needed to the config
npm install
grunt
If you need to run more than one server at a time, follow the first 2 steps of the previous list,
then copy the basic config and change the app name and port of the new config, then run grunt
.
If you have ideas for improving this scaffold or find it useful, please let me know.