module.exports = function (app) { const router = require('express').Router(), customerCtl = require('../controllers/customer'); // On routes that end in /customers router.route('/') .get(customerCtl.getCustomers_get) .post(customerCtl.createCustomer_post) // On routes that end in /customers/:customer_id router.route('/:customer_id') .get(customerCtl.getCustomer_get) .put(customerCtl.updateCustomer_put) .delete(customerCtl.deleteCustomer) app.use('/api/customers', router); };