Rails and Sinatra
With translations properly stored, we can now write our Translator app using Sinatra. Sinatra is a domain-specific language (DSL) for quickly creating web applications in Ruby with minimal effort. The âHello worldâ is just a few lines of code:
â | â# myapp.rbâ |
â | require â'sinatra'â |
â | get â'/'â âdoâ |
â | â'Hello world!'â |
â | âendâ |
We wonât access the Sinatra application directly, but weâll integrate it with our Rails app. This allows us to reuse all the structure we already have in the Rails ecosystem, such as tests, sessions, authentication, and so on. Before we develop our Sinatra application, letâs write an integration test once again using Capybara to make our tests more robust and ...
Get Crafting Rails 4 Applications, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.