games-express-api/routes/adminGames.js

21 lines
527 B
JavaScript

import express from 'express'
const router = express.Router()
import { list, show, create, update, remove } from '../controllers/adminGames.js'
import { protect, authorize } from '../middleware/auth.js'
import advancedResults from '../middleware/advancedResults.js'
import Game from '../models/Game.js'
router.use(protect)
router.use(authorize('admin'))
router.route('/')
.get(advancedResults(Game), list)
.post(create)
router.route('/:id')
.get(show)
.put(update)
.delete(remove)
export default router