Drkcore

15 02 2009 lisp Tweet

Common Lispのwebサーバー(hunchentoot)

macbookでaserveがうまく動かせないのでhunchentootを使ってる。日本語の通しかたをみつけたので早速。あとcl-whoもちょっといじってみた。

(require :hunchentoot)
(require :cl-who)
(setq *server* (hunchentoot:start-server :port 4242))
(setf (hunchentoot:log-file) "./server.log")
(setq hunchentoot:*hunchentoot-default-external-format*
     (flex:make-external-format :utf-8 :eol-style :lf))
(setq hunchentoot:*default-content-type* "text/html; charset=utf-8")
(setq hunchentoot:*dispatch-table*
     (list (hunchentoot:create-regex-dispatcher "^/$" 'hello-world)))
(defun hello-world ()
 (cl-who:with-html-output-to-string
     (str nil :prologue t)
   (:html (:head (:title "hello world"))
             (:body (:h1 "はろはろ リスプってますよ") (:br) (:img :src 
"http://ec2.images-amazon.com/images/I/51gfHrLAtTL._SS500_.jpg")))))

hunchentoot

このながれで、hunchentootでblosxomクローンでもつくってみるかな。

About

  • もう5年目(wishlistありマス♡)
  • 最近はPythonとDeepLearning
  • 日本酒自粛中
  • ドラムンベースからミニマルまで
  • ポケモンGOゆるめ

Tag

Python Deep Learning javascript chemoinformatics Emacs sake and more...

Ad

© kzfm 2003-2021