Enable CORS so sites can use directly in JS. Fixes #43.
This commit is contained in:
parent
2de59bb48d
commit
b9fb645bac
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user