What are the differences between the Erlang Web Gateway Interface (EWGI) and Webmachine?

421 views Asked by At

Both EWGI and Webmachine provide abstractions of HTTP in Erlang. I would like to know what the key conceptual differences are in their approach?

2

There are 2 answers

0
Justin Sheehy On BEST ANSWER

EWGI provides an abstract place for HTTP middleware, and is essentially blind to anything deeper than the existence of a Request/Response pair. This is a tried and true pattern for stacking layers of systems to build a coherent whole, but it does not help to make that whole system to be correct or understandable.

Webmachine contains an explicit model not just for handling requests, but for managing the internal semantics of the HTTP protocol itself. By providing the application developer with a straightforward and expressive way to describe their application's HTTP behavior, Webmachine makes it very easy to create systems that are shaped like the Web and are very easy to understand.

The two systems are potentially complementary. Right now Webmachine only uses mochiweb-provided requests and responses, but if a solid patch was provided that allowed Webmachine to act as an EWGI application was produced I suspect that it would be accepted. Given the shape of the two systems this should not be too large an undertaking.

0
Christian On

EWGI is supposed to be a common API for writing request handlers, an API that many web servers implement. EWGI is inspired by Python's WSGI.

Webmachine is just a standalone application with its own API that it is alone in implementing.