const routes = require('express').Router(); const models = require('../../core/models'); //const postService = require('./post.service')(models.Post); //const postController = require('./post.controller')(postService); const { ModelHandler } = require('sequelize-handlers'); const postHandler = new ModelHandler(models.Post); routes.use((req, res, next) => { // here we can access the req.params object and make auth checks next(); }); routes.get('/posts', postHandler.query()); /*routes.get('/posts', function (req, res) { postController.find(req).then(data => { console.log(data); res.status(200).json(data); }) });*/ routes.get('/posts/count', function (req, res) { //res.status(200).json(postController.count(req)); }); routes.get('/posts/:id', function (req, res) { //res.status(200).json(postController.findOne(req)); }); module.exports = routes;