added support to use this as a module in addition to being a standalone express server