mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-13 14:44:43 -04:00
Update to use proper way to render view and fix upload image error should response with code
This commit is contained in:
parent
4d7c3d2120
commit
87f4d05e8e
3 changed files with 28 additions and 81 deletions
12
app.js
12
app.js
|
@ -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');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue