Questions tagged [webmachine]

WebMachine is an Erlang framework for creating RESTful Web Services using Erlang/OTP best practices.

Webmachine is an application layer that adds HTTP semantic awareness on top of the excellent bit-pushing and HTTP syntax-management provided by mochiweb, and provides a simple and clean way to connect that to your application's behavior.

A Webmachine application is a set of resources, each of which is a set of functions over the state of the resource. We really mean functions here, not object-methods, infinite-server-loops, or any other such construction. This aspect of Webmachine is one of the reasons why Webmachine applications are relatively easy to understand and extend.

These functions give you a place to define the representations and other Web-relevant properties of your application's resources -- with the emphasis that the first-class things on the Web are resources and that their essential properties of interaction are already quite well defined and usefully constrained.

For most Webmachine applications, most of the functions are quite small and isolated. One of the nice effects of this is that a quick reading of a resource will give you an understanding of the application, its Web behavior, and the relationship between them. Since these functions are usually referentially transparent, Webmachine applications can be quite easy to test. There's no need for mock objects, fake database connections, or any other wastes of time when you can write tests against each component of your application in terms of the input and output to various functions.

We believe that by giving Web developers a system with conventions that directly map to HTTP and REST, we help them to write and extend Web applications quickly while not dictating the shape of the rest of their application. The resulting applications are straightforward to examine and maintain, and have very easily understood HTTP semantics. It is also available for ruby as webmachine-ruby

36 questions
18
votes
3 answers

Erlang (or elixir) performance (requests per second) is slow vs jruby?

Being a rubyist, I decided to take on erlang for high performance, reliable backend. The setup is quite simple: get a post request, write stuff to redis, return statistics. All json. this is also why I care so much about requests per second. Tools…
orotemo
  • 263
  • 1
  • 3
  • 8
6
votes
4 answers

Getting started with mochiweb and Webmachine?

Mochiweb and webmachine are very promising applications when you see how those who have found they're way around them are using it. I need to be directed to where I can find beginners' tutorials on mochiweb. It appears there is no website dedicated…
Muzaaya Joshua
  • 7,736
  • 3
  • 47
  • 86
6
votes
2 answers

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

Both EWGI and Webmachine provide abstractions of HTTP in Erlang. I would like to know what the key conceptual differences are in their approach?
Ben Ahlan
  • 497
  • 6
  • 9
4
votes
3 answers

How to make webmachine play nice with websockets?

Webmachine seems like a great system to build REST web services, but I know it does not provide websocket compatibility. My question is rather straightforward : What would be a good approach to add websocket capabilities on top of a web service…
matehat
  • 5,214
  • 2
  • 29
  • 40
4
votes
1 answer

How can I process a POST submission in Webmachine?

Can some kind soul show me how to write, or point me to, a SIMPLE Webmachine request to process a POST request; e.g. submitted by something like:
Username:
Lloyd R. Prentice
  • 4,329
  • 3
  • 21
  • 31
4
votes
2 answers

webmachine and redirect unauthenticated users

In my new project I want to use webmachine and mochiweb. First thing i want to do is authentication. I edit "dispatch.conf" and make some resources, like: {["auth"], my_res_auth, []}. {["protected"], my_res_protected, []}. {['*'], my_res_default,…
danechkin
  • 1,306
  • 8
  • 15
4
votes
1 answer

Webmachine with http and https?

What is the recommended way of getting https working with webmachine? I see that there is an example for getting mochiweb working with https and http. I just can seem to translate that to webmachine. In particular how do you handle both http and…
noenzyme
  • 43
  • 5
3
votes
2 answers

Debugging Erlang Webmachine resource functions

I'm trying to learn how to write Erlang Webmachine resources. One resource throws an error, but I can't tracking it down. The error message in the crash report does not provide enough information. Is there a way to test these functions in the…
Lloyd R. Prentice
  • 4,329
  • 3
  • 21
  • 31
3
votes
4 answers

Erlang: is there a way to export some other module's exports from my module?

I'm writing several resources for webmachine that share lots of same functions. So I'm wondering if it's possible to write the common functions in a separate module, then somehow include it, and have its exports automatically exported by the…
loxs
  • 1,476
  • 1
  • 12
  • 27
2
votes
5 answers

Has anyone ported WebMachine (written in Erlang) to Java?

I'd be amazed if nobody has ported the Basho WebMachine toolkit written in Erlang (http://wiki.basho.com/Webmachine.html) to Java, but I can't seem to find one! I know there are various attempts at Java REST toolkits (JAX-RS, RESTlets, 1060…
PMcB
  • 21
  • 2
2
votes
2 answers

How can I integrate Webmachine into an Erlang Application?

I read and re-read the docs and tutorials, but my understanding of how to create Erlang Applications, and Rebar for that matter, still has enough holes to resemble Swiss cheese. Very simple stuff throws me. I'm working toward an Erlang Release that…
Lloyd R. Prentice
  • 4,329
  • 3
  • 21
  • 31
2
votes
1 answer

Choosing Erlang webserver

Yep, subjective question. But here are a lot of such questions that got good answers. So now I have to try to develop some REST API with Erlang, as I got from google I have to install some webserver, such as Cowboy, Webmachine, Yaws, Mociweb. But…
Daria
  • 861
  • 11
  • 29
2
votes
1 answer

How to configure webmachine to send crashes to lager, instead of only returning them via http?

By default, if a webmachine handler crashes, the crash stack trace is returned in the body of the 500 error response. Is there a way to configure it to log to lager (or some other logging system)?
loxs
  • 1,476
  • 1
  • 12
  • 27
2
votes
1 answer

erlang webmachine not reading dispatch.conf

I'm working through an online tutorial on webmachine http://en.wikiversity.org/wiki/Web_Development_with_Webmachine_for_Erlang. I've downloaded the source from github, created a new application using /webmachine/scripts/new_webmachine.sh prp then…
2
votes
1 answer

How can I make Webmachine and eredis work together?

I've been meditating on the question of Redis usage in my Webmachine application for a week. And I haven't enlightened yet. I'm going to use Eredis and here is an example of usage: {ok, Con} = eredis:start_link(). {ok, <<"OK">>} = eredis:q(Con,…
N.A.
  • 69
  • 4
1
2 3