Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Preview
Start a free Courses trial
to watch this video
You've probably heard of Ruby on Rails, which is Ruby's most popular framework for writing web apps. But there's a much simpler alternative, called Sinatra. Rails uses a complex software development pattern called Model-View-Controller to generate HTML pages for users. Sinatra just gives you the request, and lets you generate a response any way you want. It's a great way to understand what web apps are all about, before moving on to the added complexity of Rails.
[MUSIC]
0:00
Hi, I'm Jay and today I'm here to teach
you how to write web apps using a Ruby
0:04
library called Sinatra.
0:08
Ruby is great for
writing apps that run on the terminal but
0:10
it can run apps that people use
from their web browsers too.
0:12
You've probably heard of Ruby on Rails,
which is Ruby's most popular framework for
0:16
writing web apps, but there's a much
simpler alternative called Sinatra.
0:20
Believe it or not,
what you see on the left is code for
0:23
a complete Sinatra web app and
what we see on the right is its output.
0:26
Rails uses a complex software development
pattern called model view controller to
0:32
generate HTML pages for users.
0:35
Sinatra just gives you the request and
0:38
lets you generate a response
any way you want.
0:40
It's a great way to understand what web
apps are all about before moving on
0:43
to the added complexity of Rails.
0:46
We'll start the course by showing you
how to install the Sinatra library and
0:49
how to create a simple app,
then we'll move on to a more complex app,
0:52
a wiki, that lets users view
text pages you've created.
0:56
We'll set up a form that allows users
to create their own wiki pages, and
1:00
then have our app save
those pages to text files.
1:03
We'll let users edit or delete existing
pages and we'll end by using layout files
1:06
with CSS to make the entire
site look more appealing.
1:11
Ready?
1:14
Let's get started.
1:15
You need to sign up for Treehouse in order to download course files.
Sign up