Ultimate ExpressJS Wrapper
Tired of adding express, method-override, cors, compression, method-override etc. to all of your expressjs frameworks? Here is the solution:
const http = ;const express = port: 3000 ; express { app;}; express;
Pretty cool isn't it?
Overriding setRoutes
In order to set your own routes, use the exaple code
express { // access your expressjs instance through app parameter.};
Overriding setErrorHandlers
In order to have your own commands for error handling (if you don't want to use default Boom):
express { // access your expressjs instance through app parameter};
Custom logging Support
In order to use custom loggers as your default logger, please use the following code:
const customLogger = { // send data to anywhere you want.};const express = port: PORT logger: customLogger ;
Rate Limit Support
Just add limiterOptions
object to ultimate expressjs constructor. This object will be used inside express-rate-limit
. For more information about the object context, please refer to express-rate-limit
npm package documentation.
Example usage of Coralogix with Rate Limiter using Redis:
const express = port: processenvPORT logger: expressLogger limiterOptions: store: client: max: 10 delay: 0 windowMs: 1 * 60 * 1000 { suspiciousLogger; ; };