Skip to content
This repository

Step 1. Install Erlang

  • (e.g. from erlang.org - CB requires R15B03 or better to compile, though Chicago Boss does not work with Erlang R16B03 due to an error in erl_syntax)
  • Using kerl https://github.com/spawngrid/kerl Please read kerl documents for easy setup and maintenance

Step 2. Download Chicago Boss and extract the archive.

Step 3. Get thee to a terminal

cd ChicagoBoss
# if you downloaded from GitHub...
./rebar get-deps 
./rebar compile
# if you downloaded from chicagoboss.org
make # actually this just runs the ./rebar commands above

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
Something went wrong with that request. Please try again.