I want to have two routes
- /midterm/cs611
- /finalterm/cs611
All i am trying to do is when i hit endpoint /midterm/cs611 it should display different content and when it hits to /finalterm/cs611 it should display different content. But i end up with correct results when hitting /finalterm/cs611 and when i hit /midterm/cs611 it shows 404 page.
If i replace like 'midterm' || 'finalterm', i see 404 page for finalterm and correct results for midterm.
Here i have my code
Here is the result hitting /midterm/cs611
Here is the result while hitting /finalterm/cs611
CodePudding user response:
In your case exam_type is always "finalterm" as you use || (or) operator. It is not going to second option i.e. "midterm". You can see finalterm route because you wrote that first, if you write midterm before finalterm you will see midterm route.
If you want two different routes, then you have to define both the routes separately instead of || (or) operator.