From 680c3cf2789c0cb5eb9d07dc3cecb0af2e877659 Mon Sep 17 00:00:00 2001 From: Hippo Date: Wed, 29 Dec 2021 23:20:30 +0530 Subject: [PATCH] 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. --- server/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/index.js b/server/index.js index 88e78ee..6d10ed0 100644 --- a/server/index.js +++ b/server/index.js @@ -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'))