const routes = require('express').Router(); const models = require('../../core/models'); const postService = require('./post.service')(models.Post); const postController = require('./post.controller')(postService); routes.use((req, res, next) => { // here we can access the req.params object and make auth checks next(); }); routes.get('/posts', function (req, res) { data = postController.find(req) res.status(200).json(data); }); module.exports = routes;