Back At It - Express Referrer

Daily Standup

Back at it! I’ve been sick for the past few weeks…in the process I learned that scarlet fever is not actually a thing of the past! Who knew. I would have thought 2 weeks at home would be the perfect opportunity to get a lot of work done on GFT. Unfortunately my body wasn’t having it.

Anyway I’m much better now so back at it!

Express Referrer on req.body

I was working on a new form input and needed to redirect the user back two pages on submitting the form, i.e. back to the page they were on before they opened the form.

I learned that Express adds a referrer onto the request object for each page—this lets you go back 1 previous page if you want (among other things I’m sure). So to go back two pages, I needed to send the referrer I wanted to the middle page and save that as a new referrer on the request body object.

This StackOverflow answer explains it much better than I just have.