Created
January 17, 2018 11:27
-
-
Save codevenkat/640ac3564dcca1782f84edd403a50a83 to your computer and use it in GitHub Desktop.
Example of having server in separate file express.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//ES6(ES2015) used | |
const express = require('express') | |
const http = require('http') | |
const app = require('./server/app') | |
const port = process.env.PORT || 8080 | |
const server = http.createServer(app) | |
server.listen(port, () => { | |
console.log(`App started. Listening on port:${port}`) | |
}) | |
/* | |
http.createServer(app).listen(port, () => { | |
console.log(`App started. Listening on port:${port}`) | |
}) | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment