Frage

I have got a basic server-side Erlang app (not fully OTP'd yet) which I start on a command-line. I want to turn it into an interactive system using a browser as GUI with Nitrogen (version 2.0.4). The general plan is to

  • turn the current module into a gen_server as the MODEL part; it analyses data and generates events from it which reflect certain properties of the data I am interested in.
  • add a CONTROLLER module which is both gen_event (to pick up events generated by the model) and gen_server (to allow queries from the GUI frontend)
  • use Nitrogen as the VIEW, updating the relevant pages with the Ajax facilities through calls to the controller module (which in turn queries the model)

As far as I can see I would want a general application supervisor with three children: the model, view, and controller. Then they would talk to each other via the APIs mapped to the OTP communication modes.

And this is where I am stuck: should I put all of this into the Nitrogen directory tree? Should I set up a new app dir structure and have the three components (including Nitrogen) under there? What exactly do I need to do to start up the Nitrogen server as a child of my app supervisor (the Nitrogen start script looks rather more complex than I expected)? I have started going through Erlang and OTP in Action, but haven't quite finished it yet. And I need to demo the system the day after tomorrow ;)

What I want is to type "start.sh" on the command-line, and then use the browser to connect to the app via Nitrogen.

Keine korrekte Lösung

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top