I am using res.redirect('/')
after a save operation in an Express project
How can I pass a certain string along with the redirect? I want to pass along some sort of notice to be displayed when the view is rendered. Many of my save/delete operations lead back to the main site or a certain subpage, so I would need a way to pass the string into the template where I can render it nicely.
I am using Coffee, Express and Jade for this project.
The function that catches that redirect is structured as such:
app.get '/', (req, res) ->
// some stuff
Can i somehow add that string to the req
object?
I suggest you use Express' req.flash, it was made for the purpose.
You can either iterate through your flashes in your template or use express-messages.