I'm trying to learn web programming in Racket
. The question is this: when I'm clicking <a>
link my localhost writes that "file in not found", although the link is all right. When in turn I run file that link points to in Dr. Racket localhost is ok. Why is that? Also how do I redirect in Racket
?
答案 0 :(得分:1)
您可以通过serve/servlet的#:extra-files-paths
选项为网络服务器提供的文件提供额外路径。
以下是基于您在评论中提供的内容的示例:
#lang web-server
(require web-server/servlet-env)
(define (start req)
(response/xexpr
`(html (head (title"")) (body (a ((href "/hello.rkt"))"go")))))
;; assuming the module is in /tmp and run from there
(serve/servlet start #:servlet-path "/query.rkt"
;; whatever extra file paths you need
;; in this example hello.rkt is in /tmp
#:extra-files-paths (list "/tmp"))