Skip to content

Instantly share code, notes, and snippets.

@httpNick
Created June 4, 2015 05:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save httpNick/b2246f8cdb6f93184c9e to your computer and use it in GitHub Desktop.
Save httpNick/b2246f8cdb6f93184c9e to your computer and use it in GitHub Desktop.
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