Skip to content

Instantly share code, notes, and snippets.

@MehulATL
Created November 26, 2015 00:17
Show Gist options
  • Save MehulATL/647f7f26ae8fcac2bac5 to your computer and use it in GitHub Desktop.
Save MehulATL/647f7f26ae8fcac2bac5 to your computer and use it in GitHub Desktop.
simple express server
// Server
var express = require('express');
var app = express();
// Store all environment variables
app.set('port', process.env.PORT || 3001);
app.set('env', process.env.NODE_ENV || 'production');
// App middleware
// serve index.html at this path
app.use(express.static(__dirname + '/client'));
app.listen(app.get('port'), function(){
console.log('Please go to localhost:' + app.get('port') + ' in your web browser.');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment