I want to add some error page for my express + ejs app. What I'm trying to do is..
- If there is an error, user will redirected to error page.
- After error page contents are displayed on browser, process is killed. (Please note that the process should be killed for my case, because of some reason.)
Below code is my current code. But the problem is CSS style, and some object (import from text file througn tag) were not rendered.
I just guess that process.exit() is excuted, before import CSS and object.
app.get('/error', async (req, res) => {
res.render('error')
console.log('Connection closed. Please restart installation.')
process.exit(1)
})
I tried to add callback function in res.render. But the result is same.
Is there any solution to do this?