Skip to content

Latest commit

 

History

History
58 lines (35 loc) · 1.35 KB

Quickstart.md

File metadata and controls

58 lines (35 loc) · 1.35 KB

Step 1. Install Erlang.

Step 2. Download Chicago Boss and extract.

Step 3. Get thee to a terminal

cd ChicagoBoss-0.6.3
make
make app PROJECT=rahm
cd ../rahm

Step 4. Write an application. Put this into src/controller/rahm_greeting_controller.erl:

-module(rahm_greeting_controller, [Req]).
-compile(export_all).

hello('GET', []) ->
    {output, "<strong>Rahm says hello!</strong>"}.

Step 5. Start the development server

./init-dev.sh

Step 6. Try it out in a web browser: http://localhost:8001/greeting/hello

Step 7. Stop the development server

q().

Step 8. Write a conformance test. Put this into src/test/functional/rahm_test.erl:

-module(rahm_test).
-compile(export_all).

start() ->
    boss_web_test:get_request("/greeting/hello", [],
        [ fun boss_assert:http_ok/1,
            fun(Res) -> boss_assert:tag_with_text("strong", 
                "Rahm says hello!", Res) end ], []).

Step 9. Build for production and run the conformance test

./rebar compile
./rebar boss c=test_functional

Step 10. There is no step 10!

Just kidding, you need to start the production server.

./init.sh start

And if you need to stop it:

./init.sh stop

Now ask all your friends to visit your web page and try to get Rahm to stop saying hello.

It simply can't be done!