I made and tested a quick dummy express app with a possible solution - using res.redirect()
const express = require('express')
const app = express()
app.use((req,res,next) => {
if(req.path === "/my-home" && req.headers['item']){
res.redirect(`/my-home/use-item-handler/${req.headers['item']}`)
}
next()
})
const handler1 = (req,res,next) => {
res.json({
item: "h1"
})
}
const handler2 =
…
Discussion