Skip to content
kotedo edited this page Aug 24, 2012 · 5 revisions

Step 1. Install Erlang.

Step 2. Download Chicago Boss and extract the archive.

Step 3. Get thee to a terminal

cd ChicagoBoss
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: (you will need a copy of boss.config named boss.test.config and reference a database for testing in this config file if you like)

-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!

Furthermore, you can hot code reload by performing two and a half simple extra steps:

0.5) Upload new the code
1) ./rebar compile
2) ./init.sh reload

Clone this wiki locally