Guest User

Untitled

a guest
Oct 20th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. INTRO and INSTALLATION
  2.  
  3. git clone git://github.com/basho/webmachine.git
  4.  
  5. cd webmachine
  6.  
  7. make
  8.  
  9. ./scripts/new_webmachine.sh gwebdev ../
  10.  
  11. cd ../gwebdev
  12.  
  13. make ; ./start.sh
  14.  
  15. Open browser to 10.0.1.38:8000 - It Works!
  16.  
  17. ADDING STATE
  18. vi priv/dispatch.conf
  19.  
  20. %%-*- mode: erlang -*-
  21. {[], gwebdev_resource, []}.
  22. {["hello"], gwebdev_resource, [{from, "Gainesville Web Dev"}]}.
  23.  
  24. vi src/gwebdev_resource.erl
  25. init(State) -> {ok, State}. %% NOTE Variable not enclosed in a list!!
  26.  
  27. to_html(ReqData, State) ->
  28. From = proplists:get_value(from, State, "Jeff"),
  29. {"<html><body>Hello, " ++ From ++ " new world</body></html>", ReqData, State}.
  30.  
  31. make; ./start.sh
  32.  
  33. Open browser to / and /hello - It Works!
  34.  
  35. REBAR
  36.  
  37. vi rebar.config
  38.  
  39. {deps, [
  40. {webmachine, "1.9.*", {git, "git://github.com/basho/webmachine", "HEAD"}},
  41. {erlydtl, "0.7.0", {git, "git://github.com/evanmiller/erlydtl.git", "HEAD"}}
  42. ]}.
Add Comment
Please, Sign In to add comment