<div class="gmail_quote">On Mon, Nov 7, 2011 at 9:05 AM, Wes James <span dir="ltr"><<a href="mailto:comptekki@gmail.com">comptekki@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Anyone know with misultin, what is the "/" or root web folder if it<br>
does exist in a simple misultin web app. I.e., you can define a web<br>
page by doing this:<br>
<br>
handle_http(Req, Port) -><br>
% output<br>
Req:ok([{"Content-Type", "text/html"}],<br>
<br>
["<html><br>
<head><br>
</head><br>
<body><br>
</body><br>
</html><br>
"<br>
]).<br>
<br>
But If I want to put some javascript in or css styles it seems I must<br>
put the whole css or javascript as a chunk in the [""] part. Is there<br>
a way to put the css or javascript content in a file and pull in with:<br>
<br>
<script src="/jquery-1.6.4.js"></script><br>
or<br>
<link rel="stylesheet" type="text/css" href="/file.css" /><br>
<br>
??<br>
<br>
That is why I'm asking if there is a "/" or root web location defined<br>
to a basic misultin app.<br>
<br>
Thanks,<br>
<br>
-wes<br></blockquote><div><br>as suggested, you may use:
<div class="highlight">
<pre><span class="nv">Req</span><span class="p">:</span><span class="n">file</span><span class="p">(</span><span class="s">"/usr/local/files/</span>jquery-1.6.4.js<span class="s">"</span><span class="p">).</span>
</pre>
</div>
<p>please refer to <a href="https://github.com/ostinelli/misultin/wiki/Exports">https://github.com/ostinelli/misultin/wiki/Exports</a> for additional info.</p> </div><div><p>you should use a dispatcher, and specify the file names, see:<br>
<a href="https://github.com/ostinelli/misultin/blob/master/examples/misultin_rest.erl#L42">https://github.com/ostinelli/misultin/blob/master/examples/misultin_rest.erl#L42</a></p>
<p>so you would have something like:</p>
<div class="highlight">
<pre><span class="nf">handle</span><span class="p">(</span><span class="n">'GET'</span><span class="p">,</span> <span class="p">[</span><span class="s">"</span>jquery-1.6.4.js<span class="s">"</span><span class="p">],</span> <span class="nv">Req</span><span class="p">)</span> <span class="o">-></span>
<span class="nv">Req</span><span class="p">:</span><span class="n">file</span><span class="p">(</span><span class="s">"/path_to_static_files/</span>jquery-1.6.4.js<span class="s">"</span><span class="p">).</span>
</pre>
</div>hope this clears up.<br><br>r.<br> </div></div><br>