Learn to write routes in Sinatra. The simplest routes are an HTTP method, a URL matching string, and a block of Ruby code to execute.
- [Instructor] In the previous movie,…we learned how to define our first route,…that is the root route or default route.…Let's review that and let's also…learn how to define more routes.…As we saw, the root route was made up of three parts.…The first part is that word get.…We'll talk more about that in a later movie.…We have get and then we have a string.…The string is a pattern that matches the URL request.…For the default route, it's just a simple /…because there's nothing that comes after it,…so when you have just that simple localhost:456…with an implied / at the end of that…and nothing following it, it's going to trigger…this code and that's the code that's between do and end.…
So it's made up of three parts, get, the matching string,…and our ruby code block, and inside that code block,…we're just returning a simple string for now,…but that code could be anything, and over time,…we're going to see how to add more complexity to that.…Next, I have a second route defined.…This one's very similar to the first one,…
- Installing Sinatra
- Launching the server
- Defining routes
- Using route patterns and parameters
- Redirecting requests
- Rendering dynamic templates
- Using partial templates and layouts
- Defining custom helpers
Skill Level Intermediate
Ruby on Rails 5 Essential Trainingwith Kevin Skoglund10h 21m Beginner
3. Helpers and Filters
4. Useful Techniques
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.