Skip to content

Instantly share code, notes, and snippets.

@louh
Created June 30, 2014 20:09
Show Gist options
  • Save louh/bd51d4d881115e829f84 to your computer and use it in GitHub Desktop.
Save louh/bd51d4d881115e829f84 to your computer and use it in GitHub Desktop.
node server.js
var PORT = 3000,
express = require('express'),
path = require('path')
var app = express()
app.set('port', process.env.PORT || PORT)
app.all('*', function(req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "X-Requested-With");
next();
});
app.use(express.static(__dirname + '/'))
app.listen(app.get('port'), function () {
console.log('Listening on port ' + app.get('port'))
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment