I've used Express (web development framework for node.js) routers and like the routing style. Below an example of some routes.
apiRouter.get("/project/:id",auth.verifyEditor,routes.getProject);
apiRouter.put("/project",auth.verifyEditor,routes.updateProject);
apiRouter.delete("/project/:id",auth.verifyEditor,routes.deleteProject);
apiRouter.get("/project/:id/page/:pageId", auth.verifyEditor,auth.verifyEditor, routes.getPage);
apiRouter.get("/project/:id/page",auth.verifyEditor,routes.getPages);
apiRouter.put("/project/:id/page",auth.verifyEditor,routes.updatePage);
It defines routes with verb (like .get( ... )), route (/project)and route-params (:id), middleware (auth.verifyEditor) and the handler (routes.updatePage)
What I like most of this style is
Routing in Asp.Net MVC is accomplished in many (and more elaborate) ways like attribute routing. Some aspects make this routing style less appealing to me:
I know it's possible to define explicit routes like:
routes.MapRoute(name:"CustomerList", template:"api/customer",defaults: new { controller = "Customer", action = "Get" });
But I'm not sure that's like swimming against the tide and I don't know the impact on performance.
Therefor my question: is there a more Express-like routing style possible and feasible in Asp.Net? Or would you suggest an other approach (preferably with key aspects "centralized", "not string-based")