2
我在helloworld.asd
定義的簡單系統:端點返回404
(asdf:defsystem #:helloworld
:description "helloworld"
:author "Duncan Bayne <[email protected]>"
:license "WTFNMF"
:depends-on (#:hunchentoot)
:serial t
:components ((:file "package")
(:file "helloworld")))
...在package.lisp
包定義:
(defpackage #:helloworld
(:use #:cl #:hunchentoot))
...和相應的hello world webserver helloworld.lisp
:
(in-package #:helloworld)
(defvar *acceptor* (make-instance 'acceptor :port 4242))
(start *acceptor*)
(define-easy-handler (greet :uri "/hello")()
"<html><body><h1>Hello World!</h1></body></html>")
在SLIME REPL I與啓動Web服務器:
CL-USER> (load "/usr/home/duncan/code/helloworld/helloworld.asd")
CL-USER> (ql:quickload "helloworld")
如果我瀏覽到http://localhost:4242/hello,我希望看到我的hello world HTML。相反,我得到一個404錯誤,並且日誌顯示:
127.0.0.1 - [2017-08-10 08:18:19] "GET /hello HTTP/1.1" 404 341 "-" "Mozilla/5.0 (X11; FreeBSD amd64; rv:54.0) Gecko/20100101 Firefox/54.0"
我懷疑我在這裏丟失了相當明顯的東西;任何提示/指針文件將不勝感激。系統細節:
Clozure Common Lisp Version 1.11 (FreebsdX8664)
FreeBSD 11.1-RELEASE amd64
Hunchentoot 1.2.37
Mozilla Firefox 54.0.1
SLIME 20170804.1113
謝謝:)我沒有注意到,有'ACCEPTOR'多個類。 –
@DuncanBayne它發生:-) – coredump