Skip to content

Instantly share code, notes, and snippets.

@omenking
Forked from sharad-s/index.js
Created August 24, 2018 19:06
Show Gist options
  • Save omenking/a447769a9019124a47825ae2a708e7e4 to your computer and use it in GitHub Desktop.
Save omenking/a447769a9019124a47825ae2a708e7e4 to your computer and use it in GitHub Desktop.
// Direct Imports
const express = require("express");
const winston = require("winston");
// Instantiate express
const app = express();
require("./startup/logging")();
require("./startup/middleware")(app);
// require("./startup/config")();
require("./startup/routes")(app);
require("./startup/db")();
require("./startup/validation")();
// PORT
const port = process.env.PORT || 5000;
const server = function() {
app.listen(port, () => {
winston.info(`Listening on port ${port}...`);
});
}
module.exports = server;
@omenking
Copy link
Author

I would wrap your server in a function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment