On 30-05-12 08:52, Konstantin Nikiforov wrote:
> Thanks for your response.
>
> Could you please describe the second approach?
> That should be return value of before_(_Action) function?
> Where to place the static file?
> I've created a controller named "myproj_js_controller.erl" and placed
> my static file into /src/view/js/file.js.html.
> File is rendered like template and no 304 Not modified is returned
> automatically.
>
It seems you are right on track. A slightly improved version.
-module(your_controller, [Req]).
before_(_Action) ->
X:log(Req->header(referer), %% log it
ok. %% return ok.
Module X is the one that you create to monitor it. Unless you have very strict real time monitoring requirements in your module X, I believe you're reinventing a web server log.
Cheers, Guido.