diff --git a/backend/index.js b/backend/index.js index ca313a3..9a54914 100644 --- a/backend/index.js +++ b/backend/index.js @@ -72,7 +72,7 @@ app.use(passport.session()); app.get("*", function (req, res, next) { if (!serverStartupComplete) - return res.send("Server is starting..."); + return res.send("Server is starting... Please try again soon."); else return next(); }); @@ -96,7 +96,7 @@ passport.use('local-login', new LocalStrategy({ email = mysql.escape(email); connection.query(`SELECT * from user WHERE email = ${email} AND deactivated = 0`, function (err, rows) { if (err) { - return res.status(static.INTERNAL_SERVER_ERROR).send(); + return res.status(static.INTERNAL_SERVER_ERROR).send("error querying the database - Please contact sys admin"); } if (!rows.length) { return done(null, false); @@ -120,7 +120,7 @@ passport.deserializeUser(function (id, done) { }); app.post("/API/user/login", passport.authenticate('local-login'), function (req, res) { - res.status(status.OK).send(); + res.status(status.OK).send("login success"); }); app.put("/API/user/create", function (req, res) { @@ -130,11 +130,11 @@ app.put("/API/user/create", function (req, res) { password = mysql.escape(bcrypt.hashSync(password, saltRounds)); connection.query(`INSERT INTO user (deactivated, email, password) values (1, ${email}, ${password})`, function (err, rows) { if (err) - return res.send(status.INTERNAL_SERVER_ERROR).send(); + return res.send(status.INTERNAL_SERVER_ERROR).send("the user seems to exist already - if you think this is an error contact the sys admin"); return res.status(status.OK).send(); }); } else { - res.status(status.BAD_REQUEST).send(); + res.status(status.BAD_REQUEST).send("invalid data supplied"); } }); @@ -143,7 +143,7 @@ app.all("*", function (req, res, next) { return next(); } else { - res.status(status.UNAUTHORIZED).send(); + res.status(status.UNAUTHORIZED).send("please log in before using this site"); } }); @@ -171,7 +171,7 @@ app.get('/API/day', function (req, res) { }); } else - res.status(status.BAD_REQUEST).send("invalid data provided"); + res.status(status.BAD_REQUEST).send("invalid data range provided"); } else