Sinatra has default locations for finding code and template files. Learn about those default file paths and how to change them to custom paths.
- [Speaker] In this chapter, we're going to learn how to…use templates in Sinatra to send back…our response to the browser.…And we're going to start by first talking about the structure…of a typical Sinatra application,…and about how we can configure the file paths…for where Sinatra finds the files that we're…going to be using.…A typical Sinatra app has a structure…of something like this.…We have our main directory, that's for our project,…and then inside there,…we have our Sinatra initialization file.…That's the file we were using in the last chapter…that was helloworld.rb.…
Here I've called it myapp.rb.…This is the file that from the command line we would…launch to get Sinatra started,…and have it start listening for requests.…Right alongside that Sinatra initialization file,…we would have two directories, public and views.…When we first launch the Sinatra app, the first thing…that Sinatra does, is it figures out what the root…of our application is.…By default, that's going to be the directory…which contains that Sinatra file.…
- 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.