Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
385 views
in Technique[技术] by (71.8m points)

phoenix framework - What is Elixir Plug?

As a newcomer to both Elixir and the web domain in general (no web framework experience) I would like to know, what is Plug? As I understand it Cowboy is a web server (albeit in Erlang, not Elixir) and Phoenix is a framework for building web apps, but where does Plug come in? Is it an abstraction layer between the two or perhaps a plug-in system in the same abstraction layer as Phoenix?

question from:https://stackoverflow.com/questions/26304727/what-is-elixir-plug

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Is it an abstraction layer between the two

Yes, exactly! Plug is meant to be a generic adapter for different web servers. Currently we support just Cowboy but there is work to support others.

Plug also defines how different components should be plugged together. Similar to Rack in Ruby, WSGI in Python, Ring in Clojure, and so on.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...