Rack is the underlying web server interface used by popular Ruby frameworks like Rails and Sinatra. I previously wrote about making a Rack server from scratch after finding a lack of how-to help while googling. Recently, I found myself digging back in after becoming inspired by Rack’s middleware stack. There are plenty of guides floating around on how to use and create middleware for Rack, but I wanted to take the stack concept itself and use it in a completely different context – something that wasn’t necessarily a web application.
Last weekend, I attended Ruby for Good at George Mason University. Ruby for Good is a cross between a mini-conference and hackathon where participants spend three days building web applications (or other software) for non-profit organizations. This was my second year attending and my first time leading a team. I personally think our team was amazing and managed to deliver a great application, but I definitely learned a few things along the way about leadership and deadlines.
tl;dr here’s a gist with all of the code.
Every web developer who spends a significant amount of time with Ruby inevitably reaches a point when they want to learn more about Rack. Rack is at the heart of the most popular Ruby web frameworks, including Rails and Sinatra. There are tons of resources available for getting started with Rack applications from the ground up, but I found myself curious about the other side of the fence. How do I write a web server that knows how to talk to Rack applications, and can I get Sinatra to serve a minimal app using that server?