O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Instant Sinatra Starter

Book Description

Your practical guide to getting started with Sinatra to quickly create simple web applications

  • Learn something new in an Instant! A short, fast, focused guide delivering immediate results
  • Set up a Sinatra project
  • Deploy your project to the Web
  • Learn about the advanced features of Sinatra

In Detail

Sinatra is a free and open source software web application library and domain-specific language written in Ruby. It provides both the beginner and the experienced professional with a tool for creating simple, yet powerful web applications.

Instant Sinatra Starter is a practical, hands-on guide that provides you with the necessary knowledge to get started from scratch.Including all the necessary steps to put together a Sinatra application and get it online, we will also learn all that you need to know to make your application all it can and should be.

We'll learn how a web request is received, pre-processed by Rack and Sinatra middleware, then handed to the application. Learn how to build a response via templates, then hand the response back to be sent to the client.L

ater we will learn to configure your application for your specific needs and handle more complex requests and responses. With Instant Sinatra Starter, we’ll explore the essentials to get our first Sinatra application online.

Table of Contents

  1. Instant Sinatra Starter
    1. Instant Sinatra Starter
    2. Credits
    3. About the Author
    4. About the Reviewers
    5. www.packtpub.com
      1. Support files, eBooks, discount offers and more
    6. packtlib.packtpub.com
      1. Why Subscribe?
      2. Free Access for Packt account holders
    7. 1. Sinatra Starter
      1. So, what is Sinatra?
        1. What is a web framework?
        2. Sinatra or Ruby on Rails?
        3. Who's using it?
        4. Minimalistic
        5. Education
        6. Performance
        7. Prototyping
        8. Source code
      2. Installation
        1. Step 1 – what do I need?
        2. Step 2 – installing library dependencies
          1. Installing a C compiler
          2. Installing external packages
        3. Step 3 – installing Ruby
          1. Installing a Ruby Version Manager
          2. Installing Ruby
        4. Step 4 – installing Bundler
        5. Step 5 – installing Git
        6. Step 6 – registering for online accounts
          1. Code
          2. Application deployment
        7. And that's it
      3. Quick start – your first Sinatra application
        1. Step 1 – creating the application
          1. Logging
        2. Step 2 – putting the application under version control with Git
        3. Step 3 – deploying the application
        4. Step 4 – page layout with Slim
        5. Step 5 – styling
        6. Step 6 – development setup
        7. Step 7 – testing the application
      4. Top 18 features you need to know about
        1. Sinatra application types
          1. Classic applications
          2. Modular style applications
        2. Runtime environments
        3. Project layout
          1. Static files
          2. Templates
        4. Middleware
        5. Sessions
          1. Session security
        6. GET requests
        7. Handling forms
          1. Uploading files
          2. Protecting your application
          3. CSRF
            1. How a CSRF attack works
            2. Implementing CSRF protection for your application
        8. Handlers, routes, and parameters
          1. Handlers
          2. Routes
            1. First to last
          3. Parameters
          4. The params variable
          5. block parameters
          6. Query parameters
          7. Wildcard or splat parameters
          8. Optional parameters
          9. Regular expressions
          10. Route conditions
            1. The provides condition
        9. Templating
          1. Inline templates
          2. HTML templates
          3. Slim
        10. Layouts
        11. Sending e-mail
        12. Logging
          1. How to write logs to a file
        13. Request
        14. Response
          1. Status
        15. Using a database
          1. Setup
          2. Create a database
          3. Insert an address
        16. The Sinatra DSL
        17. Helpers
        18. Settings
      5. People and places you should get to know
        1. Official sites
        2. Articles and tutorials
        3. Community
        4. Blogs
        5. Twitter