Do logic on data after post
I'm building an exam app. Where a tutor makes an exam and a student answer to this exam. I want to show the result to this exam after the student has posted all his answer. I use to express and MongoDB. When I show the result this is with the exam + the answer of the student. I mean this is multiple choice, so I show good answer if the student took the bad one and need to show when is good.
I was thinking about make a middleware where this one does the correction and post a result document.
Do you have any other strategies how I can handle this?
You don't need a middleware to do that. All you need to do is to redirect the user to the result page with the student id.
Since you know the student id and their answers, you can render the result page according to the answers they have submitted.