app2-api/modules/blog/blog.routes.js
2019-04-15 17:58:58 +02:00

16 lines
467 B
JavaScript

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;