Coding with Sinatra

As a SysAdmin I do love my work but sometimes we need to code also!

Some months ago I found this awesome microframework.
Sinatra





“… Sinatra is a DSL for quickly creating web applications in Ruby with minimal effort:…”

Well thats it. I need move some tasks from command line to the web and Sinatra is what I have found to be the most cool.


# sudo gem install sinatra
# vi mywebapp.rb

require 'rubygems'
require 'sinatra'

get '/' do
  erb :index
end

__END__

@@layout
<html>
  <head></head>
  <body>
    <%= yield %>
  </body>
</html>

@@index
Helloa!

# ruby mywebapp.rb ; lynx http://localhost:4567

Easy right? Next post I will introduce some more stuff about Sinatra and maybe CRUD operations coded from the root.

take care.

PS: I do need to think about this CSS!! It’s a PITA!!

Leave a Comment

Related Posts