Created
June 4, 2015 05:14
-
-
Save httpNick/b2246f8cdb6f93184c9e to your computer and use it in GitHub Desktop.
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 express = require('express'); | |
var app = express(); | |
var port = process.env.PORT || 8080; | |
app.set('view engine', 'ejs'); | |
app.all("/*", function(req, res, next) { | |
res.header("Access-Control-Allow-Origin", "*"); | |
res.header("Access-Control-Allow-Headers", "Cache-Control, Pragma, Origin, Authorization, Content-Type, X-Requested-With"); | |
res.header("Access-Control-Allow-Methods", "GET, PUT, POST"); | |
return next(); | |
}); | |
app.use(express.static(__dirname + '/public')); | |
app.get('/', function(req, res, next) { | |
res.render('index'); | |
}); | |
app.listen(port, function() { | |
console.log('Our app is running on http://localhost:' + port); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment