I am using node with express.
I have two rest api, the difference between the api is only database table only.
API - 1 http://localhost/test1
API - 2 http://localhost/test2
Both are post methods,
router.post('test1', findAll);
router.post('test2', findAll);
function findAll(req, res){
//Here test1 api result get from different db table.
//Here test2 api result get from different db table.
How can I sent the db table name in parameters?
//Here have logic in db and return results.
res.send(spec.resp);
}
Note: I need to use same function for both api but the table name only will be change.