diff --git a/server/app.js b/server/app.js index 0f4c50d..cc6c4fa 100644 --- a/server/app.js +++ b/server/app.js @@ -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);