Search code examples
erlangchicagoboss

Trouble linking ChicagoBoss controllers to views


I'm making a website in Erlang, but I'm having troubles. I installed Chicagoboss and the server starts, but I have a problem. They say to go to this page localhost:8001/pages/index when i go to this page I get an error:

No routes matched the requested URL. (Don't worry, this message will not appear in production.)

I did not do anything, I coded the file in src/controllers/main.erl. What am I doing wrong?


Solution

  • I've never used ChicagoBoss, but this question is extremely basic and you should read carefully tutorial before asking. Take a look how the requested URL is dispatched:

    host:port/yourcontroller/youraction
    

    will invoke function like

    youraction('GET', []) -> {output, "Hello World!"}.

    from file src/controller/PROJECT_yourcontroller_controller.erl. This sample works out of the box. In general case look at PROJECT/priv/PROJECT.routes to define rules to bind URL patterns to their controllers actions.