It's been a lot of installation and figuring out what goes where, but I'm starting to see some cool stuff. I really like the idea of running a web application through Yaws. Erlang has always made a lot of sense to me with it's light-weight application threads and message passing.
More Details
I didn't do anything special from the standard way of installing packages in Ubuntu. I don't think there's anything special other thansteve@ubuntu$ sudo apt-get install yawsThis should install all the dependencies, including Erlang which you'd need to get started. The yaws service is started, using
/usr/share/yawsas a home directory for the server. Starting/stopping/restarting the service is as easy as:
steve@ubuntu$ sudo service yaws <command>
First Examples
I just have a couple very simple examples right now. Hopefully more to come shortly. One thing I've found is that if you modify index.html in the server's home directory, changes can be seen by visiting localhost:8080/index.html but not simply localhost:8080 until you perform a server restart (or maybe reload). Most likely due to file handles of the server. Fortunately, creating examples and running <erl> tags within new files works because you specify the URL for the files explicitly, so you don't have to restart the server between every step.First output
The first example was straight from the book. Creating method.yaws in the server home directory:<erl>Then browsing to localhost:8080/method.yaws shows that you used a get request.
method(Arg) ->
Rec = Arg#arg.req,
Rec#http_request.method.
out(Arg) ->
{ehtml, f("Method: ~s" , [method(Arg)])}.
</erl>
Simple Redirect
The next simple example is to redirect to another page:<erl>This simply redirects to the method.yaws example above.
method(Arg) ->
Rec = Arg#arg.req,
Rec#http_request.method.
out(Arg) ->
{ehtml, f("Method: ~s" , [method(Arg)])}.
</erl>