Hasan edited this page Mar 22, 2016 · 22 revisions

Step 1. Install Erlang

  • (e.g. from erlang.org - CB requires R16B 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 these 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]).
hello('GET', []) ->
    {output, "<strong>Rahm says hello!</strong>"}.

Step 5. Start the development server


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

Step 7. Stop the development server


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)

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 the new code
1) ./rebar compile
2) ./init.sh reload
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.