Is there a way to set all routes accepted by Express to start with /api without explicitly defining it?
Current:
this.app.get('/api/endpoint-A', (req, res) => {
return res.send('A');
});
this.app.get('/api/endpoint-B', (req, res) => {
return res.send('B');
});
Objective:
this.app.get('/endpoint-A', (req, res) => {//https:host.com/api/endpoint-A
return res.send('A');
});
this.app.get('/endpoint-B', (req, res) => {//https:host.com/api/endpoint-B
return res.send('B');
});