Appendix B. Beyond Yaws

This book has been an introduction to using Yaws with Erlang. However, there are a number of other web servers and frameworks for Erlang that may make more sense for a specific project.

Web Servers

In addition to Yaws, there are two other Erlang web servers in active development: Cowboy and MochiWeb. Each has a different set of pros and cons that should be considered.

A detailed comparison of different Erlang web server options could be a book in and of itself. However, a good place to start is http://www.ostinelli.net/a-comparison-between-misultin-mochiweb-cowboy-nodejs-and-tornadoweb/, which attempts to compare Misultin, MochiWeb, and Cowboy along with Node.js (JavaScript) and Tornadoweb (Python).

Cowboy

Cowboy (https://github.com/extend/cowboy) is a new web server for Erlang designed to be small, fast, and modular. It is also designed to be easy to embed in other applications, which can be useful if you are creating a web interface to a larger Erlang application.

To set up a Cowboy server you must create some socket listeners and handlers to deal with incoming requests. So compared to Yaws, there is a bit more upfront set up required, you can’t just give it a bunch of static files or embed Erlang in .yaws files and go. You must explicitly tell it how to handle requests.

Cowboy can also handle web sockets, and there is example code on the Cowboy GitHub page; however, work is still ongoing on that project. It is unclear how much support there is for file uploads, ...

Get Building Web Applications with Erlang now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.