I want to allow someone to fill out a form without being logged in but then ask for registration/login if they want to save the data. If I use middleware to check this how do I hold on to the information they've filled in before saving the record?
Below is my post request at present
app.post('/running', urlencodedParser, async (req, res) => {
const plan = new planHeader({
title: req.body.title,
startDate: req.body.planHeader.startDate,
targetdate: req.body.planHeader.targetdate,
planlength: req.body.planHeader.planlength,
creator: req.user._id
});
await plan.save();
res.redirect(`/running/${plan._id}`)
})