Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Feb 6, 2013
1 parent 6f7cdb2 commit 23d14dc
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions bin/serve
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,13 @@ if (program.less) {
}

// CORS access for files
if(program.cors) {
server.use(function(req, res, next) {
if (program.cors) {
server.use(function(req, res, next){
res.setHeader('Access-Control-Allow-Origin', '*');
res.setHeader('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS');
res.setHeader('Access-Control-Allow-Headers', 'Content-Type, Authorization, Content-Length, X-Requested-With, Accept, x-csrf-token, origin');
if(req.method === 'OPTIONS')
return res.status = 200, res.end();
return next();
if ('OPTIONS' == req.method) return res.end();
next();
});
}
// static files
Expand Down

0 comments on commit 23d14dc

Please sign in to comment.