Created
April 22, 2018 20:38
-
-
Save adeelibr/f1eec0ea85ed5457664e5719820c3aa9 to your computer and use it in GitHub Desktop.
Node server basic bare bone file
This file contains 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
const express = require('express'); | |
const path = require('path'); | |
const http = require('http'); | |
const app = express(); | |
// Point static path to dist | |
app.use(express.static(path.join(__dirname, '..', 'dist'))); | |
const routes = require('./routes') | |
app.use('/', routes); | |
/** Get port from environment and store in Express. */ | |
const port = process.env.PORT || '3000'; | |
app.set('port', port); | |
/** Create HTTP server. */ | |
const server = http.createServer(app); | |
/** Listen on provided port, on all network interfaces. */ | |
server.listen(port, () => console.log(`Server Running on port ${port}`)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment