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