Enable CORS so sites can use directly in JS. Fixes #43.

This commit is contained in:
Ian Webster 2015-09-06 08:20:43 -07:00
parent 2de59bb48d
commit b9fb645bac

View File

@ -18,6 +18,12 @@ app.use(express.cookieParser());
app.use(express.static(__dirname + '/public')); app.use(express.static(__dirname + '/public'));
app.use(express.json()); app.use(express.json());
app.use(express.urlencoded()); 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. // Enable log messages when sending texts.
text.debug(true); text.debug(true);