// // MapsController.swift // App // // Created by Michael Simard on 10/29/21. // import Fluent import Vapor import Foundation struct MapsController: RouteCollection { func boot(routes: RoutesBuilder) throws { let matchRoute = routes.grouped("cod-tracker","api", "maps") matchRoute.get("all", use: maps) matchRoute.get("game-modes", use: gameModes) matchRoute.get("game-mode-groups", use: gameModeGroups) } func maps(req:Request) -> EventLoopFuture<[Map]>{ return Map.query(on: req.db).all() } func gameModes(req:Request) -> EventLoopFuture<[GameMode]>{ return GameMode.query(on: req.db).all() } func gameModeGroups(req:Request) -> EventLoopFuture<[GameModeGroup]>{ return GameModeGroup.query(on: req.db).all() } }