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 used make to build it and started it with the standard start script. The skeleton app runs fine and you can see the home page but there is no dispatch.conf file present in the /priv directory and even if I add one it doesn't seem to pick it up - amongst the startup log I can see there is a (default?) dispatch setup but adding and altering dispatch.conf doesn't change it.
=PROGRESS REPORT==== 23-Jul-2014::20:03:32 ===
supervisor: {local,prp_sup}
started: [{pid,<0.81.0>},
{name,webmachine_mochiweb},
{mfargs,
{webmachine_mochiweb,start,
[[{ip,"0.0.0.0"},
{port,8080},
{log_dir,"priv/log"},
{dispatch,[{[],prp_resource,[]}]}]]}},
{restart_type,permanent},
{shutdown,5000},
{child_type,worker}]
I've looked around to see if the configuration has moved somehow but the documentation that comes with the source seems to suggest /priv/dispatch.conf is correct. I'm stumped - any help would be gratefully accepted.
Thanks,
Joe
The example that you are following is not correct. When using new_webmachine.sh
to create you webmachine app, the configuration of the routes will not be stored in priv/dispatch.conf
but created in src/prp_config.erl
.
In order to get it to use dispatch.conf
you need to change prp_config:dispatch/0
to:
-spec dispatch() -> [webmachine_dispatcher:route()].
dispatch() ->
{ok, Routes} = file:consult("priv/dispatch.conf"),
Routes.
and then add priv/dispatch.conf
as:
{[], prp_resource, []}.