Use "send" instead of "end" at end of requests

This is so that they show as pages and the browser doesn't try to
download them instead.
This commit is contained in:
Hippo 2021-12-29 23:20:30 +05:30
parent 349d9ae8a4
commit 680c3cf278

View file

@ -149,7 +149,7 @@ router.post('/pledge', async (req, res) => {
let messages = req.body.messages
if (!!errors.length) {
res.end(`Errors: ${'' + errors}`)
res.send(`Errors: ${'' + errors}`)
return
}
@ -170,11 +170,11 @@ router.post('/pledge', async (req, res) => {
try {
await pledge.save()
} catch (err) {
res.end("Sorry, something went wrong while saving your pledge and we don't know what 🙁. Please try again...")
res.send("Sorry, something went wrong while saving your pledge and we don't know what 🙁. Please try again...")
return
}
res.end("Thank you! We're still working on setting up this website, so as you can see this page doesn't look great at the moment, but we will be sending you a confirmation email in a few days. Watch out for an email from editors@snipettemag.com, and if it doesn't reach, check your spam box :P")
res.send("Thank you! We're still working on setting up this website, so as you can see this page doesn't look great at the moment, but we will be sending you a confirmation email in a few days. Watch out for an email from editors@snipettemag.com, and if it doesn't reach, check your spam box :P")
})
router.use(express.static('dist'))