If we have a look at the existing config/routes.rb file, we'll see that running rails generate has added a route for us (omitting comments): # config/routes.rb Lastly, we need to wire up the application's root route to the controller method we created. Another not-so-subtle difference in the two frameworks. On the other hand, inline is the most natural approach with Sinatra. ![]() However this is not considered good practice in a Rails app as you're working against the framework. 2.1 Sinatraįirst, we create the directory and the Ruby code needed to serve up our "Hello World!" endpoint. To avoid repeating ourselves, we'll name our apps public-bookmarks-sinatra and public-bookmarks-rails, even though initially they'll do nothing more than print 'Hello World' on a web page. PostgreSQL DB (if you're on OS X 10.9, Postgres.app is recommended)Ģ Deploying a 'Hello World' app to Heroku.Git (you can also brew install git if you're on a Mac).Rails 4 ( gem install rails, or gem update rails if you have an older version installed). ![]() This tutorial assumes you have the following installed and available: In this article, we're going to compare the relative merits of Ruby on Rails and Sinatra by building the same web app in both frameworks. He currently works at Nulogy as a Software Developer, where he enjoys practicing TDD and pair programming on a daily basis. He has built and scaled apps on LAMP stacks as well as on Ruby on Rails. Paul has over ten years of full-stack web applications development experience.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |