Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jacksongl/ruby-tutorial
Tutorial for CS169 Discussion Sections
https://github.com/jacksongl/ruby-tutorial
Last synced: about 1 month ago
JSON representation
Tutorial for CS169 Discussion Sections
- Host: GitHub
- URL: https://github.com/jacksongl/ruby-tutorial
- Owner: JacksonGL
- Created: 2016-02-03T22:05:49.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-09-04T21:49:08.000Z (over 8 years ago)
- Last Synced: 2024-10-26T00:08:10.765Z (3 months ago)
- Size: 10.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# CS169 Week3 Section
A basic tutorial of Sinatra.### Requirements
This tutorial assumes that you are using the Cloud9 IDE.Find a partner and begin typing the following exercises. You should alternate who types and who explains the output.
#### Install the Sinatra Gem
Type the following command in the C9 terminal:
```
gem install sinatra
```
#### Write a Hello World Sinatra App
Create an empty Ruby workspace. In the root directory of your workspace, create a file ```app.rb```. Type the following content in the file:
```ruby
require "sinatra"get "/" do
"Hello, world!"
end
```
#### Start the App
Type the following command in C9 terminal:
**Note:** Type the following content literally, do not replace anything.
```
ruby app.rb -p $PORT -o $IP
```
#### Try Your App
In your browser, type the following URL to try your first Sinatra app:
```
http://-.c9users.io
```
Replace `````` and `````` with your C9 root directory name and your C9 username respectively. For example, my url is: ```https://test-sinatra-jacksongl.c9users.io/```.#### Exercise:
Add another page to your site with URL ```http://..c9.io/about```.
The page should display content: ```My name is .```Go the [next page](RESTFul-1.md) of this tutorial.