Dr Blinken

blog, bentosheets and railspages.

Seven Web Frameworks in Seven Weeks, Week 1: Sinatra

Week 1, Day 1

Source Code

/hello - hello world
/crud - simple crud rest backend using data mapper

Self-Study

Find:

Do:

Urls to open

http://localhost:4567/bookmarks/1

Week 1, Day 2

Templating languages: erb, slim (a bit like haml but cleaner), mustache (with {} like liquid, no logic in the template).

Self-Study

Find:

Do:

Does work with slim, apparently not with mustache, maybe because it’s not known to Sinatra? http://www.sinatrarb.com/contrib/respond_with.html

Week 1, Day 3

Self-Study

Find:

Do:

…learned more about curl

Dump Headers

curl -D headers http://localhost:4567

send accept type

curl -H "Accept: application/json" http://localhost:4567/bookmarks

and get header info

curl -i -H "Accept: application/json" http://localhost:4567/bookmarks

more to copy

curl -H “Accept: text/html” http://localhost:4567/bookmarks -H “Accept: application/json”

Added Capybara, see http://blog.orenyk.com/2014/03/11/testing-sinatra-apps-with-rspec-and-capybara/