mercredi 1 avril 2015

Naming convention in controller to distinguish between middleware and endpoints

Here is a route instance:



route.post('/api/someResource/:id', ctrl.getResource, ctrl.doStuff, ctrl.doMore, ctrl.finish);


I wanted to rename these methods to have the prefix First, Then, Finally, i.e.



route.post('/api/someResource/:id', ctrl.FirstGetResource, ctrl.ThenDoStuff, ctrl.ThenDoMore, ctrl.FinallyFinish);


This way, it is very clear that my FirstGetResource is an entry point, the ThenDoStuff and ThenDoMore are middlewares and FinallyFinish is an endpoint.


Is this a bad naming convention?


Aucun commentaire:

Enregistrer un commentaire