What you can learn from Elixirs HTTP Middleware Plug?
summary
Built a tiny Elixir HTTP server called Stupify that accepts one request at a time using :gen_tcp line mode, parses status line and headers, and maps them into a Plug.Conn struct (27 fields) so any Plug can be invoked. Implementation shows the adapter contract: implement send_resp, send_file, send_chunked, read_body and multipart support (six callbacks total) and return a payload. Demo proves it works end-to-end with Phoenix-compatible plugs and Cowboy adapters optional.
AI-written summary · about
chapters (12)
- 0:00Introduction
- 1:24Elixir and Plug basics
- 3:11Plug as HTTP interface
- 6:22Minimal web server with Plug
- 11:39TCP listener and acceptor loop
- 14:11HTTP request parsing
- 16:43Web server to Plug connection
- 21:22Plug connection struct
- 24:35Plug adapters and responses
- 28:30Plug-compatible callbacks
- 30:16Key learnings from Plug
- 32:22Live demo: Stupify
related talks
39mJust Enough Plug to Build a Web server
39m"Elixir-based Ruby Web Server"
32mBuild your very own web framework in Elixir
01h 00mPhoenix: an Intro to Elixir's Web Framework
06mIntroducing Raxx, an Elixir Webserver Interface
34mAnatomy of a Real Time Elixir App
48mElixir by the Bellyful
47mElixir for curing product development pains
