UNPKG

paradigm-core

Version:
28 lines (18 loc) 825 B
const {Dispatcher: {dispatch}} = require('structure-core') const Controller = require('./controller') const controller = new Controller() const express = require('express') const router = express.Router() router.get(`/match/:slug`, dispatch(controller, 'matchBySlug')) router.get(`/slug/:slug`, dispatch(controller, 'getBySlug')) router.get(`/:id`, dispatch(controller, 'getById')) router.get(`/`, dispatch(controller, 'getAll')) router.patch(`/:id`, dispatch(controller, 'updateById')) router.post(`/`, dispatch(controller, 'create')) router.delete(`/:id`, dispatch(controller, 'deleteById')) module.exports = function routeInterface(options = {}) { return { routeName: 'categories', routes: router } }