At the (eighth RacketCon), a number of workshops were held. This document covers the tutorials on web programming.
There are four tutorials. Once you’ve installed this package, use raco to launch each of them, like so:
raco 2018-web-workshop first
Doing that launches the first server (or, if you prefer, web application) on your local machine. Instead of first, you can use second, third, and fourth to launch the others.
(This material has been adapted from the first few chapters of my ebook Server: Racket—Practical Web Development with the Racket HTTP Server.)
Wherein we build a web server that does nothing but respond 200 OK to every request it receives.
This sounds trivial. And it is. But the point is to get our feet wet and see what a web server in Racket looks lik.
Wherein we build a web server that greets us in a random language (the body of the response is random), while also giving us, tucked away in the Location header, a URL that tells us its own URL, which isn’t random.
In addition to learning how to modify bits of a "response?", we also learn about the powerful dispatch-rules macro and how it helps us to build URLs.
Wherein we build a web server that generates HTML, prompting the user for input, which we duly process.
We learn about include-template, one of the various HTML templating techniques out there.
Wherein we build a web server that has state in the form of cookies to implement a very basic theme switcher.