Skip to content

Latest commit

 

History

History
72 lines (55 loc) · 1.89 KB

README.md

File metadata and controls

72 lines (55 loc) · 1.89 KB

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:

Build the skeleton application:

$ rebar3 compile

Start up the skeleton application:

$ rebar3 release
...
$ ./_build/default/rel/webmachine_demo/bin/webmachine_demo console

or

$ rebar3 shell

Change the basic application:

  • edit src/webmachine_demo_resource.erl

Test the filesystem resource:

$ mkdir /tmp/fs
$ echo "Hello World." > /tmp/fs/demo.txt

Test the file upload resource:

Add some new resources:

  • edit src/YOUR_NEW_RESOURCE.erl
  • edit src/webmachine_demo_config.erl's dispatch/0 function

View logs:

  • when starting with _build/.../webmachine_demo console, look in _build/default/rel/webmachine_demo/priv/log
  • when starting with rebar3 shell, look in priv/log

On the fly editing

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