Created
June 30, 2014 20:09
-
-
Save louh/bd51d4d881115e829f84 to your computer and use it in GitHub Desktop.
node server.js
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
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