What is Plug?

Can someone please help me understand what Plug is. I’m aware that Phoenix uses Plug and Cowboy. What purpose does Plug serve? A web server like Apache or Nginx does not need anything like Plug to serve up files. Why does Cowboy need Plug? Can Plug be used without Cowboy? Sorry if this is a stupid question, I’m still learning and just trying to figure out how all of the pieces fit.

https://hexdocs.pm/plug/readme.html

https://codewords.recurse.com/issues/five/building-a-web-framework-from-scratch-in-elixir

http://www.phoenixframework.org/docs/understanding-plug

3 Likes