Erlang web Libraries & frameworks

Source: Internet
Author: User

Reprinted: http://lenary.co.uk/erlang/2011/08/erlang-web-libraries/

I'll try to keep this updated as more information comes to light. please email me if anything is factually incorrect.

Recently I needed to compare a few Erlang web libraries and frameworks for a friend who was writing a simple internal API endpoint. He suggested I shoshould publish the rundown for others, so here it is.

Thanks to everyone that has provided corrections and updates since I originally published this post.

Yaws

Thanks to Steve vinoski for pointing out I 'd missed yaws

Yaws is a high performance WEB server aimed mostly at serving dynamic web pages. However, using
Appmod, it is possible to construct an API instead.

The yaws documentation is good, and it looks very well put together. It can be embedded into a supervision hierachy.

Mochiweb

This one seems to be one of the most-used libraries for API development with Erlang. Overall it does the job, but it does have a few quirks.

The docs for mochiweb aren't very good, and it uses parameterised modules quite a lot, which I don't like. That said, it's trivial to embed into another Erlang application.

Misultin

Thanks to pointers from Andrew Thompson, I added this section, as well as the sections on cowboy and zotonic

Misultin seems very similar in general architecture to mochiweb, doesn't that it also has des support for websockets.

The examples are well put-together and clear. There is also copious documentation in
Their wiki.

Cowboy

Cowboy is also fairly similar to mochiweb, only without the parameterised modules and instead using whole modules to handle requests. cowboy is (I think) one of the only fully-binary HTTP servers, for increased speed and lower memory usage.

There are examples of how to use it in
This repository on GitHub.

Httpd

The httpd module comes bundled as part of the inets application, which suggests that it's good enough for lots of uses, and if you need to get up and running quickly. httpd is the only one on the list with support for wsgi-or rack-like middleware, for chaining
Arbitary request handlers together.

Unfortunately, it also has a fixation on using one single callback function and the docs aren't that great. To help when writing httpd mod, Garret Smith wrote
Modlib which is a wrapper library to help clear up the API somewhat.

Simplebridge

Thanks to lo running C hoguin and Jesse gumm for both poining out simplebridge.

Speaking of wrappers, simplebridge is a project "to provide a simple, standardized interface to Erlang HTTP servers ". what this means in practice is that you wrap the framework you're using's request and response objects in some simplebridge adapters so
That it's slightly easier to change which library you're actually using.

I feel that simplebridge doesn't quite go far enough to be a HTTP library adapter. It has support for mochiweb, inets httpd and yaws, with support for misultin in the pipeline.

Webmachine

This is built upon mochiweb, but cannot acts you away from lots of the lower-level HTTP semantics. Instead it bills itself as a "Rest toolkit ".

For basic RPC over HTTP applications, this isn' t what you 'd use, however, it makes lots of sense if the application is very resource-orientated. as it's come out of Basho, I 'd expect CT it to be well written and then ented.

Nitrogen

Thanks to Jesse gumm for telling me that it is indeed possible to write an API endpoint with nitrogen.

Nitrogen is aimed more at building functional user interfaces. It brings its own system for sending events back and forth between the client and the server which I find very interesting. Here's
Introduction to nitrogen.

As every page is just a module, and templates are optional, It is trivial to construct an API with nitrogen.

Zotonic

Zotonic is a fully-fledged CMS, with supported support for websocets and comet. It is easy to extend, and there is quite a lot of documentation on their site.

From what I can tell, it uses webmachine and nitrogen underneath, but it is also possible to define your own API inside a site, complete with oauth support.

Chicago boss

This framework is much closer to what rails is for Ruby. it has models and lots of already-implemented behaviour to bring you up to speed quickly. probably too complex for a simple API, but it depends on what you're re doing.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.