[erlang-questions] misultin question

Roberto Ostinelli <>
Tue Nov 8 03:22:43 CET 2011


On Mon, Nov 7, 2011 at 9:05 AM, Wes James <> wrote:

> Anyone know with misultin, what is the "/" or root web folder if it
> does exist in a simple misultin web app. I.e., you can define a web
> page by doing this:
>
> handle_http(Req, Port) ->
>    % output
>    Req:ok([{"Content-Type", "text/html"}],
>
> ["<html>
> <head>
> </head>
> <body>
> </body>
> </html>
> "
> ]).
>
> But If I want to put some javascript in or css styles it seems I must
> put the whole css or javascript as a chunk in the [""] part.  Is there
> a way to put the css or javascript content in a file and pull in with:
>
> <script src="/jquery-1.6.4.js"></script>
> or
> <link rel="stylesheet" type="text/css" href="/file.css" />
>
> ??
>
> That is why I'm asking if there is a "/" or root web location defined
> to a basic misultin app.
>
> Thanks,
>
> -wes
>

as suggested, you may use:

Req:file("/usr/local/files/jquery-1.6.4.js").

 please refer to https://github.com/ostinelli/misultin/wiki/Exports for
additional info.

you should use a dispatcher, and specify the file names, see:
https://github.com/ostinelli/misultin/blob/master/examples/misultin_rest.erl#L42

so you would have something like:

handle('GET', ["jquery-1.6.4.js"], Req) ->
    Req:file("/path_to_static_files/jquery-1.6.4.js").

hope this clears up.

r.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20111107/deb2006d/attachment.html>


More information about the erlang-questions mailing list