-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
27 lines (20 loc) · 734 Bytes
/
Copy pathapp.js
File metadata and controls
27 lines (20 loc) · 734 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
var express = require('express');
var app = express.createServer();
var allowCrossDomain = function(req, res, next) {
res.header('Access-Control-Allow-Origin', 'http://filmsurf.herokuapp.com');
res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS');
res.header('Access-Control-Allow-Headers', 'Content-Type, Authorization, Content-Length, X-Requested-With');
if (req.method === 'OPTIONS') {
res.send(200);
} else {
next();
}
};
app.configure(function () {
app.use(allowCrossDomain);
app.use(app.router);
});
require('filmsurf-routes').bind(app);
var port = process.env.PORT || 8000;
app.listen(port);
console.log("Server running at http://localhost:" + port);