diff options
author | Wu Cheng-Han | 2016-08-19 11:31:23 +0800 |
---|---|---|
committer | Wu Cheng-Han | 2016-08-19 11:31:23 +0800 |
commit | 87f4d05e8e8f36ac276cd85601cabc1fbb7efc2c (patch) | |
tree | 3341cdb5bc1950b1012f6945315cd40d304bfee1 /app.js | |
parent | 4d7c3d21206ef61de2323f2138dd99cf5dbf5d31 (diff) |
Update to use proper way to render view and fix upload image error should response with code
Diffstat (limited to 'app.js')
-rw-r--r-- | app.js | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -165,9 +165,11 @@ app.use(function(req, res, next) { // routes need sessions //template files -app.set('views', __dirname + '/public'); +app.set('views', __dirname + '/public/views'); //set render engine -app.engine('html', ejs.renderFile); +app.engine('ejs', ejs.renderFile); +//set view engine +app.set('view engine', 'ejs'); //get index app.get("/", response.showIndex); //get 403 forbidden @@ -185,7 +187,7 @@ app.get("/500", function (req, res) { //get status app.get("/status", function (req, res, next) { realtime.getStatus(function (data) { - res.end(JSON.stringify(data)); + res.send(data); }); }); //get status @@ -447,11 +449,11 @@ app.post('/uploadimage', function (req, res) { }) .catch(function (err) { logger.error(err); - return res.send('upload image error'); + return res.status(500).end('upload image error'); }); } catch (err) { logger.error(err); - return res.send('upload image error'); + return res.status(500).end('upload image error'); } } }); |