Server Side Swift with Vapor: Basic Controllers | Ray Wenderlich

In this screencast, you'll learn how to create basic controller objects to organize the routes for your web apps.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/5002-server-side-swift-with-vapor-basic-controllers

Great screencast, Ray!

Waiting for a authorization screencast.
Please, cover how to build a simple and secure authorization for mobile clients and how to access a protected resource.

Thanks!

Nice! Exactly what I needed. Iโ€™m a first time backend developer after some dabbling with RoR 12 years ago.
What would be a nice addition to these SSS screencasts, IMHO, is how to provide proper unit tests for all these handlers.
But other topics, like middleware, authentication and error handling are more important.

Is there a reason you are not using RouteCollection?

https://vapor.github.io/documentation/routing/collection.html

@sadiq81 Actually I wasnโ€™t even aware of RouteCollection before you mentioned it. Looking at it, Iโ€™m unsure what advantage it has over adding a simple addRoutes() method like I did in the screencast. Any thoughts?

At the moment one reason i can see as that its more specialized, you only have access to a route builder and not the droplet, so you wonโ€™t get tempted to add droplet related code inside. Perhaps in the future it will have more functions.

Great Video Ray. Thanks, from Peru!

@sadiq81 Good point! Thanks for bringing it to my attention.

@keyner Thanks! :]