By Darren Jones

This brief SitePoint publication presents readers with a enjoyable and but functional creation to Sinatra, a framework that makes internet improvement with Ruby very simple. it is not meant to be a totally entire advisor to the framework or an in-depth Ruby instructional, yet will fast get you on top of things with Sinatra and provides you the arrogance to begin experimenting by yourself. The ebook is equipped round a real-life instance undertaking: a content material administration method. it is a enjoyable and simply comprehensible undertaking that's used to illustrate the strategies defined within the publication in a realistic manner.

Show description

Read Online or Download Jump Start Sinatra PDF

Similar languages & tools books

SOA for the Business Developer: Concepts, BPEL, and SCA

Service-Oriented structure (SOA) is a manner of organizing software program. in case your company's improvement tasks adhere to the rules of SOA, the end result may be a listing of modular devices referred to as "services," which permit for a fast reaction to alter. This publication tells the SOA tale in an easy, elementary demeanour that can assist you comprehend not just the buzzwords and advantages, but additionally the applied sciences that underlie SOA: XML, WSDL, cleaning soap, XPath, BPEL, SCA, and SDO.

Extra info for Jump Start Sinatra

Sample text

This is where Sinatra comes in. In fact, this is what Sinatra is all about—connecting Ruby to the Web! rb file doesn’t use Sinatra at all. This is to emphasize that it’s just a plain old Ruby program. ” in Chapter 1, Sinatra is simply used to connect Ruby programs to the Web using HTTP requests and responses. rb file from Chapter 2. /song' Now we just need to create some route handlers and views to deal with our songs. ” in Chapter 1 that the Web is built around the HyperText Transfer Protocol, or HTTP.

Ol’ Blue Eyes Adding Some Style Now that we have a public folder, let’s add some CSS to make the site a bit prettier. To do this, we first need to create a global stylesheet that will apply styles to all the pages. Save this page in the public folder. Here’s some basic styling of headings and paragraphs, which includes our logo as a background image to the heading. com/books/cssant4/. 4 Helvetica, Arial, sans-serif; } Now we’ll add a link to this file. It needs to be added to all the pages, so the best place to put it is in the layout.

Com/ I’m a big fan of Slim as it reads just like HTML, but without any of the angle brackets and closing tags. Slim uses indentation to avoid closing brackets. css" body header h1 Songs By Sinatra Notice how it looks a lot tidier and easier to read without all those angle brackets? Ruby can also be embedded in Slim files in much the same way as ERB. A hyphen [-] is used to start blocks of logic that are not to be displayed: - name = '

DAZ

' An equals sign, [=], is used for Ruby that’s to be evaluated and sent to the browser: = name This will be sent back as escaped HTML, so for this snippet the browser would display the full string “

DAZ

”.

Download PDF sample

Rated 4.80 of 5 – based on 49 votes