RubyFlow The Ruby and Rails community linklog


The Ruby and Rails community linklog

Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!

Sinatra gone async with em-fiber_pool and em_mysql2.

Meet em-shorty, a modern URL shortener. This Sinatra app is completely async by using rack-fiber_pool and em_mysql2. If you have been curious about how async Sinatra works, this is a good sample to get you started. It’s even setup with sinatra-activerecord so you have standard migrations and several database connectors to choose from.

There is a full API. It’s easy to create or query urls in XML/JSON/YAML. Lots of things were done to add polish, including localization, less support for stylesheets, Bundler and RVM to make installation a breeze, and of course a thorough test suite. The code is at Clipboard support is provided by ZeroClipboard. BTW, the screencast that started this little project deserves some credit.


Wow, someone rewrote my text in a big way… wasn’t expecting that.

I edited it (capitalization, punctuation, added a couple of links to things you mentioned) and changed the spacing but I didn’t rewrite it.

Why? Because it was taking up too much space on the front page. If you look at the other posts there, most of them are short, tight, single paragraph pages. You can then put “extra” stuff in to the comments section. I run a tight front page ;-)

This is covered in point 4 when you post: Unless necessary, post in a single paragraph. Your post may be edited to rectify this. So.. I did ;-)

Nonetheless, good post.

I don’t think he said that in a negative way. :)

Yeah I am fine with it, was just surprised when I refreshed the page. Honestly as long as people check it out on github I don’t care how it’s formatted. =)

Great example, thanks ! I felt surprised that you don’t use async_sinatra at first glance, but using rack fiber pool looks very straight forward. will look into it deeper to understand really how it works async.

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in