const routes = require('express').Router(); routes.use((req, res, next) => { // here we can access the req.params object and make auth checks next(); }); routes.get('/posts', function (req, res) { res.status(200).json({ message: 'Connected!' }); }); module.exports = routes;