Ver código fonte

feat: allow user to pass in own Express app

Brett Zamir 3 anos atrás
pai
commit
95eac69a72
1 arquivos alterados com 4 adições e 5 exclusões
  1. 4 5
      createServer.js

+ 4 - 5
createServer.js

@@ -5,11 +5,10 @@ import rateLimit from 'express-rate-limit';
 import routes from './api/routes/bDateRoutes.js'; // importing routes
 
 /**
-* @returns {ExpressApp}
-*/
-function createServer () {
-  const app = express();
-
+ * @param {ExpressApp} app
+ * @returns {ExpressApp}
+ */
+function createServer (app = express()) {
   app.use(rateLimit({
     windowMs: 1 * 60 * 1000, // 1 minute
     max: 20