From the course: Blockchain Programming in iOS Using Swift
Unlock this course with a free trial
Join today to access over 22,600 courses taught by industry experts.
Setting up a controller and services
From the course: Blockchain Programming in iOS Using Swift
Setting up a controller and services
- [Teacher] Okay, so now that we have confirmed that our route for "Hello, world!" is working, or any other route if we build one, it's working, we can go ahead and implement all the routes right over here in the routes.swift file. But it's not really recommended that you do this way, because this particular file can grow up to be very big, and it will turn into a really bad, dirty spaghetti code. So let's go ahead and organize the record in a form of controller and services. So instead of writing all the code of our block chain over here, what I'm gonna do is I'm gonna add a brand New File, which will serve as a blockchain controller. So all the different actions or routes that's gonna happen will be going inside the block chain controller. So BlockchainController, make sure that it is added to the "App" Target as you can see, go ahead and add it, there we go. The first thing I wanna add is import the Vapor, and now I can create a class called BlockchainController. Now inside the…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.