Building a basic HTTP server with plain old Ruby & Rack

Occasionally, I find myself in need for a basic HTTP server that will render some static content (HTML, CSS, images,..), no complex installation, only build and launch. As I am a huge Ruby fan, I was wondering how can I achieve this in the simplest way possible with plain Ruby.

What we will build

A basic HTTP server, serving a static HTML file. The Install process should be as small as possible, and launching the server should be fast and with a single command.

Running SSL on localhost without going mad

I admit it, this title is a little clickbaity. Have you tried to setup SLL for your local dev environment lately? Does it make you want to bang your head against a wall? Then this article might be for you, I battle tested this on different laptops, and it served me well. Let’s be clear, this is superfluous, and most of the times it’s unnecessary. You can probably live without using SSL/HTTPS for your local dev, but sometimes you may want to be able to do just that, because your work environment requires it, for consistency with what runs on the cloud, or to secure a little communications with external services.

Your first CLI tool with Rust

In the wonderful world of programming, you may have heard about this new shiny language called Rust. It is an open-source systems programming language that focuses on speed, memory safety, and parallelism. It allows you to do low-level programming à la C/C++.

You might have heard about it in the context of Web Assembly. Rust is capable to compile WASM applications, you can find a wide variety of use cases on the Web Assembly FAQ. It is also known as the basis of servo, a high-performance browser engine, implemented in Firefox.

Saving your back in git

Here is a usefull collection of git commands that I keep coming back to, it saved me countless times when I was in tricky situations. I have finally decided to compile them here, I hope it can help you too!