Recently, I have startet working on a REST api in erlang & Yaws. I don't understand how yaws & my module handle multiple requests.
I do have api module gathering all requests :
appmods = </, api>
and my test module :
-module(api).
out(_Arg) ->
io:format("my pid ~p ~n", [self()]),
loop(200000000),
[{status, 200}, {header, {"Vary", "Accept"}},
{content, "application/json", ""}].
At this point, my understanding is that yaws spawns only one instance of my api module and sends there all the requests. And so, only one request can be handled at any given time.
Is there a way to spawn more processes of api module and spread requests among them?
Or should I do a lot more of appmods for every single type of API request?
Or is my understanding of how does yaws work is fundamently wrong?
Thanks for help.