On Wed, Jul 4, 2012 at 10:34 PM, Matt Jadud <[email protected]> wrote:
> Hi all,
>
> I'm trying to 1) serve static files from a directory relative to my
> script and 2) handle a single POST of some JSON. My goal is to be able
> to compile/share this when I'm done. I'd ideally like to be able to
> control the port, choose whether a browser is opened, and control the
> endpoint for the static content and servlet.

You probably do want to use the #:extra-files-path, but using
current-working-directory might not be robust.  You might use the
define-runtime-path form to get a path that's relative to the script.
For example:

;;;;;;;;;;;;;;;;
(require racket/runtime-path (for-syntax racket/base))

;; htdocs is a path that's relative to this script's location.
(define-runtime-path htdocs (build-path "htdocs"))


...
(serve/servlet ... #:extra-files-paths (list htdocs) ...)


You might want to adjust #:servlet-path to be more discriminating;
rather than use "/", try something like "/json".  Otherwise, all your
web requests get sent over to your request handler.  That's probably
why none of the static files are being served successfully.
____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Reply via email to