<div dir="ltr">Thanks, Loïc, I will then check out Cowboy in more detail, to see how it feels.<div><br></div><div>regards,</div><div>Vlad</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Mar 7, 2016 at 8:44 PM, Loïc Hoguin <span dir="ltr"><<a href="mailto:essen@ninenines.eu" target="_blank">essen@ninenines.eu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 03/07/2016 08:27 PM, Vlad Dumitrescu wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi!<br>
<br>
I am an almost complete noob regarding this, so please excuse me if I am<br>
asking questions with obvious answers.<br>
<br>
I have an application that I'd like to expose via a REST api. From what<br>
I could find quickly, in the Erlang world it looks like the main options<br>
are Webmachine and Cowboy.<br>
<br>
Does anyone have any advice on which one fits better my requirements, as<br>
below?<br>
<br>
- the server must be embeddable in another application, i.e. possible to<br>
start/stop without a release<br>
</blockquote>
<br></span>
No problem for that with Cowboy, either through a function call or provided child specs.<span class=""><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
- it must be possible to configure it to use a dynamic port value<br>
(multiple independent servers may run on the same machine)<br>
</blockquote>
<br></span>
No problem, set {port, 0} option and then call ranch:get_port/1.<span class=""><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
- the REST API is delegating to an Erlang API, so ease of implementation<br>
would be nice :-)<br>
</blockquote>
<br></span>
Cowboy is inspired by Webmachine so I suppose they're pretty close for this one.<span class=""><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
- if it is possible to run multiple servers on the same Erlang runtime,<br>
then it would be a big plus<br>
</blockquote>
<br></span>
No problem, just declare more than one listener and you're good!<span class="HOEnZb"><font color="#888888"><br>
<br>
-- <br>
Loïc Hoguin<br>
<a href="http://ninenines.eu" rel="noreferrer" target="_blank">http://ninenines.eu</a><br>
Author of The Erlanger Playbook,<br>
A book about software development using Erlang<br>
</font></span></blockquote></div><br></div>