mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
returning json for 404
This commit is contained in:
parent
eb6fe138a0
commit
e4f7d32b1c
1 changed files with 8 additions and 2 deletions
|
@ -265,7 +265,10 @@ Object.keys(modules).forEach(function (key) {
|
||||||
|
|
||||||
app.get('*', (req, res) => {
|
app.get('*', (req, res) => {
|
||||||
if (req.headers['content-type'] === 'application/json') {
|
if (req.headers['content-type'] === 'application/json') {
|
||||||
res.status(404).end()
|
res.status(404).json({
|
||||||
|
message: '404',
|
||||||
|
success: false,
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
res.status(404).render('404')
|
res.status(404).render('404')
|
||||||
}
|
}
|
||||||
|
@ -273,7 +276,10 @@ app.get('*', (req, res) => {
|
||||||
|
|
||||||
app.post('*', (req, res) => {
|
app.post('*', (req, res) => {
|
||||||
if (req.headers['content-type'] === 'application/json') {
|
if (req.headers['content-type'] === 'application/json') {
|
||||||
res.status(404).end()
|
res.status(404).json({
|
||||||
|
message: '404',
|
||||||
|
success: false,
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
res.status(404).render('404')
|
res.status(404).render('404')
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue