Loading
Lesson 11
Courses / Quick Start Introduction to Sails
Review of Sails Blueprint REST Routes and Controller Actions

Video Transcript

Let's do a quick review about the routes it provides. Going back to my gist here in git hub. By the way, again, if you want to take a look at this gist, you can go to my gist profiles nbkhope gist.github.com.nbkhope and you can click sales, blueprint, rest. And here are the ones we learned. We learned these guys here. So we learned how to get a specific list of resources and that maps to the fine controller action. We learned how to get a specific resource and that maps to the fine one controller action. So we learned how to create a resource using pulse slash resource, which maps to the controller.createAction. So these actions are all automatically generated by the blueprint API and you will not see them written explicitly in the controller file. The controller file is going to be empty as we can see if you go to API slash controller slash company controller. You can see there's nothing there, but actually there's something going on behind the scenes. And for the to update a resource using put, you can which is mapped to the update controller action. Then finally we saw that you can also delete a resource at slash resource slash its ID and it maps to the destroy controller action. So these control actions are all provided by the blueprint API. If you want to override them and change customize them, you can always do so just define these actions in the controller file. For example, just a brief example, if you would like to change the behavior of the controller action. So if you did a pulse slash resource and it's going to go to controller set dot create, but you don't want it to go through the blueprint API. So you can override that if you go to the editor and you can define here create in the company control file, okay, and define your controller as so and that is going to automatically override and it's going to use your definition instead of the behind the scenes definition. Okay. So just that. So this is it. That's it for this lecture. We learned about the blueprint rest routes, the controller actions and see you next time. Bye.
No comments yet (loading...)
No comments yet (loading...)
Did you like the lesson? 😆👍
Consider a donation to support our work: