Project Skeleton for the webmachine_demo app.
You should find in this directory:
README : this file Makefile : simple make commands rebar.config : configuration for Rebar3 /src /webmachine_demo.app.src : application information file for OTP /webmachine_demo_app.erl : base module for the Erlang application behavior /webmachine_demo_config.erl : configuration interface for your application /webmachine_demo_sup.erl : OTP supervisor for the application /webmachine_demo_resource.erl : a simple example Webmachine resource /webmachine_demo_fs_resource.erl : a simple filesystem resource /webmachine_demo_upload_resource.erl : a simple file upload resource /priv /www : a convenient place to put your static web content
You probably want to do one of a couple of things at this point:
$ rebar3 compile
$ rebar3 release
...
$ ./_build/default/rel/webmachine_demo/bin/webmachine_demo console
or
$ rebar3 shell
- edit src/webmachine_demo_resource.erl
$ mkdir /tmp/fs
$ echo "Hello World." > /tmp/fs/demo.txt
- Visit http://localhost:8000/upload
- Upload a file
- Look in folder priv/www/uploads
- edit src/YOUR_NEW_RESOURCE.erl
- edit src/webmachine_demo_config.erl's
dispatch/0
function
- when starting with
_build/.../webmachine_demo console
, look in_build/default/rel/webmachine_demo/priv/log
- when starting with
rebar3 shell
, look inpriv/log
We're using sync
now to do on the fly compilation of resources.
Once you're in a console, just type sync:go().
and it will recompile
your files on the fly, but you'll have to use the dev profile:
$ rebar3 as dev shell