Skip to content

Instantly share code, notes, and snippets.

@ToJans
Created May 17, 2013 16:08
Show Gist options
  • Save ToJans/5600132 to your computer and use it in GitHub Desktop.
Save ToJans/5600132 to your computer and use it in GitHub Desktop.
set path=%path%;c:\Program Files\erl5.10.1\bin
git clone https://github.com/basho/rebar.git
E:\Dev\erlang\rebar>rebar -c
clean Clean
compile Compile sources
escriptize Generate escript archive
create template= [var=foo,...] Create skel based on template and vars
create-app [appid=myapp] Create simple app skel
create-node [nodeid=mynode] Create simple node skel
list-templates List available templates
doc Generate Erlang program documentation
check-deps Display to be fetched dependencies
get-deps Fetch dependencies
update-deps Update fetched dependencies
----><8------- cut for brevity
E:\Dev\erlang\erlcdemo>rebar create-app appid=helloworld
==> erlcdemo (create-app)
Writing src/helloworld.app.src
Writing src/helloworld_app.erl
Writing src/helloworld_sup.erl
-module(helloworld).
-compile(export_all).
hi() ->
hi("stranger").
hi("Tom") ->
hi("silly sod");
hi(Who) ->
io:format("Hello ~s!~n",[Who]).
-module(helloworld).
-compile(export_all).
start() ->
application:start(crypto),
application:start(ranch),
application:start(cowboy),
axiom:start(?MODULE).
% Hi url without parameter
handle(<<"GET">>, [<<"hi">>], _Req) ->
hi();
% Hi url with parameter
handle(<<"GET">>, [<<"hi">>, Name], _Req) ->
hi(Name).
hi() ->
hi("stranger").
hi(<<"Tom">>) ->
hi("silly sod");
hi(Who) ->
FormattedList = io_lib:format("<h1>Hello ~s!</h1>~n",[Who]),
erlang:iolist_to_binary(FormattedList).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment