-
Notifications
You must be signed in to change notification settings - Fork 30
/
quickstart.lisp
59 lines (37 loc) · 1.3 KB
/
quickstart.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
(in-package #:cl-user)
;;; First ASDF install the dependencies
(eval-when (:compile-toplevel :execute :load-toplevel)
(require 'asdf-install))
;;; WARNING -- SIGNATURES NOT CHECKED!
(let ((pkgs
(remove-if (lambda (p) (asdf:find-system p nil))
'(iterate cffi cl-irregsexp trivial-backtrace parenscript))))
(handler-bind (((or asdf-install::key-not-found asdf-install::download-error asdf-install::no-signature)
(lambda(c) (declare (ignore c)) (invoke-restart 'asdf-install::skip-gpg-check))))
(when pkgs
(apply 'asdf-install:install pkgs))))
;;; Load tpd2
(eval-when (:compile-toplevel :load-toplevel :execute)
(handler-bind ((error (lambda(c) (declare (ignore c)) (invoke-restart 'CONTINUE))))
(asdf:oos 'asdf:load-op 'teepeedee2)))
(defpackage #:teepeedee2.quickstart
(:use #:cl #:tpd2 #:tpd2.ml.html))
(in-package #:teepeedee2.quickstart)
;;; Define a /hello page
(defsite *hello*)
(with-site (*hello*)
(defpage "/hello" (name) :create-frame nil
(<h1 "Hello " name)))
;;; Start tpd2 listening
(http-start-server 8080)
;;; Enter the event-loop
(format t "
Finished everything.
Launching server!
Please visit http://localhost:8080/hello?name=New+TPD2er
")
#+sbcl
(sb-thread:make-thread #'event-loop :name "tpd2")
#-sbcl
(event-loop)
;;; Visit http://localhost:8080/hello