November 2018
Intermediate to advanced
404 pages
10h 16m
English
Vapor allows you to use route collection in managing the collection of related routes. With route collection, you can divide your routes and let one sub-router that implements RouteCollection protocol handle a segment of routes. Each sub-router doesn't need to handle all routes, as it is responsible for the routes that it can handle only.
In /Sources/App/routes.swift, instantiate a RouteCollection and register it with the router:
import Vapor/// Register your application's routes herepublic func routes(_ router: Router) throws { let journalRoutes = JournalRoutes() try router.register(collection: journalRoutes)}
Create the Routes directory under /Sources/App and add JournalRoutes.swift to this new directory: ...
Read now
Unlock full access