Skip to content

Commit

Permalink
Enable CORS so sites can use directly in JS. Fixes #43.
Browse files Browse the repository at this point in the history
  • Loading branch information
typpo committed Sep 6, 2015
1 parent 2de59bb commit b9fb645
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions server/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ app.use(express.cookieParser());
app.use(express.static(__dirname + '/public'));
app.use(express.json());
app.use(express.urlencoded());
app.use(function(req, res, next) {
// Enable CORS so sites can use the API directly in JS.
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept');
next();
});

// Enable log messages when sending texts.
text.debug(true);
Expand Down

0 comments on commit b9fb645

Please sign in to comment.