Arc Forumnew | comments | leaders | submitlogin
Ask Arc Forum: CSS and Image organization w/Arc Web Server
4 points by croach 6097 days ago | 2 comments
I've read through Ken Shirriff's great post on Ajax and Arc and so I know that the Arc server has problems with hosting Javascript files, but I've recently noticed another problem with the Arc server as well--file organization. Basically, since the request handler uses the first piece of text in the url after the server name to define the server op that it calls, it would seem that you can't put any image or css files in directories to organize them. Does anyone know of a way around this issue other than running Apache to serve the static text (e.g., css and js) and image files or placing all of the static css and image files in the main Arc directory?


2 points by absz 6096 days ago | link

I've had plenty of luck using the Anarki (the git wiki); it has support for specifying a root "static files" directory, and maps files in there to MIME types by extension. In other words, to set the root directory to "/home/croach/site/", run

  (= rootdir* "/home/croach/site/")
Now, if you have the file "/home/croach/site/js/script.js", then going to "http://localhost:8080/js/script.js" will serve the Javascript. Mimetypes are stored in the table ext-mimetypes* , and can be accessed and added to as expected. For instance,

  arc> (ext-mimetypes* "js")
  "text/javascript; charset=utf-8"
  arc> (ext-mimetypes* "svg")
  nil
  arc> (= (ext-mimetypes* "svg") "image/svg+xml; charset=utf-8")
  "image/svg+xml; charset=utf-8"
Now, all your SVG files with extension ".svg" will be served with the proper MIME type and headers. I hope that helps with your problem!

-----

1 point by croach 6096 days ago | link

Thanks absz, I'll take a look into the Anarki solution as soon as my work day comes to an end. Thanks for the response.

-----