added Access-Control-Allow-Origin header to all responses

Signed-off-by: Walamana <joniogerg@gmail.com>
This commit is contained in:
Walamana 2017-11-28 20:49:10 +01:00
parent f54817bcbe
commit 761f79f238

11
app.js
View File

@ -39,7 +39,6 @@ app.get('/login', (req, res) => {
var username = req.query.username;
var password = req.query.password;
if(username == undefined || password == undefined){
res.send({success: false, error: "Missing parameters"});
return;
@ -137,12 +136,22 @@ var attachToMini = function(mini){
}
app.configure(function(){
app.use((req, res, next) => {
res.setHeader("Access-Control-Allow-Origin", "*");
return next();
});
app.use(express.static(path.join(application_root, "StaticPages")));
app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
});
app.listen(process.env.PORT);
function isConnected(){
if(con.isConnected){
return true;