This is my app.js
app.use('/v1/abc/', router);
Then secondary level
router.use('/:primary_id/def',defServices);
Final service level
class defServices {
constructor() {
const router = new express.Router({ mergeParams: true });
router.get('/', this.func1);
router.get('/:pid',this.func2);
router.put('/', this.func3);
return router;
}
async func1(req, res) {
//code goes here
}
}
export default new defServices();
My request
GET http://localhost:3000/dev/v1/abc/48/def
I'm having an issue with the first GET endpoint not reaching and getting 404 responses, but the second, GET endpoint and third PUT endpoint works fine. Furthermore, this implemented in serverless-offline