title: What is the best practice for organizing similar routes and controllers in expressjs?
body: <p>So I have a <code>routes/index.js</code> file where I define all my routes and import whatever controllers I need. For example, a route that I've defined might look like:</p>
  <pre><code>router.get('/cars', carsController);
  </code></pre>
  <p>My main question is what is the best practice for handling similar looking routes for different http methods? Should I make a completely new controller file for each http method? I feel like that could result in a lot of controller files over time. Should I reuse a single controller for all http methods and then use logic inside the controller to determine what to do? (<code> if (req.method === 'GET')</code>, etc).</p>
  <p>Single controller example (single, larger controller file):</p>
  <pre><code>router.get('/cars', carsController);
  router.get('/cars/:id', carsController);
  router.put('/cars/:id', carsController);
  router.post('/cars', carsController);
  router.delete('/cars/:id', carsController);
  </code></pre>
  <p>Multi-controller example (multiple, smaller controller files):</p>
  <pre><code>router.get('/cars', getCarsController);
  router.get('/cars/:id', getCarsController);
  router.put('/cars/:id', updateCarsController);
  router.post('/cars', createCarsController);
  router.delete('/cars/:id', deleteCarsController);
  </code></pre>
  <p>Is there a best practice to follow for this kind of scenario? What do you guys do in your own projects?</p>