0.1.4 • Published 7 years ago
osseus-server v0.1.4
Osseus Server
express based osseus web server module
Install
$ npm install osseus-serverUsage
Configuration
Mandatory:
OSSEUS_SERVER_PORT
Optional:
REQUEST_ID_HEADER* set request id header name to enable cc-request-id middlewareMAINTENANCE_ENABLED* set totrueto enable maintenance mode on serverMAINTENANCE_MESSAGE* maintenance message sent to clients when maintenance mode is enabledMAINTENANCE_OVERRIDE_HEADER* bypass maintenance mode with this headerALLOWED_IP* list of ip addresses allowed to bypass maintenance modeCOMPRESION_ENABLED* set totrueto enable compression middlewareCOMPRESSION_LEVEL* compressions level if compression is enabledNO_COMPRESSION_HEADER* don't compress responses with this request headerMORGAN_FORMATformat for morgan see morgan predefined formats * default is tinyCORS_WHITELIST* configuring CORS w/ dynamic originSTATIC_ENGINE_TYPEVIEWS_FOLDER* use template enginesSTATIC_FOLDER* serve static filesADD_HEALTHCHECK* add/healthcheckendpoint which returnsOKwith status code 200ADD_IS_RUNNING* add/is_runningendpoint which returnsOKwith status code 200
Example
First, create index.js:
const Osseus = require('osseus')
const main = async () => {
try {
// init osseus
const osseus = await Osseus.init()
} catch (err) {
console.error(err)
}
}
main()Running:
$ node index.js --OSSEUS_SERVER_PORT 8080Will result in:
server is listening on port: 8080Contributing
Please see contributing guidelines.
License
Code released under the MIT License.