aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Okay <okay@toyful.space>2022-02-09 06:29:38 -0600
committerColin Okay <okay@toyful.space>2022-02-09 06:29:38 -0600
commit9e27e583bd64143ed20e8a37fd0c0aa5de1f07b2 (patch)
treead0f64ae473b9b930eee0a5b21ba37704f4fdf49
parent3fb29879cfcd73795fd3127f38db2cffeb3e0cc3 (diff)
added second example to readme
-rw-r--r--README.md49
1 files changed, 47 insertions, 2 deletions
diff --git a/README.md b/README.md
index 7baec7b..4299384 100644
--- a/README.md
+++ b/README.md
@@ -33,10 +33,55 @@ encourages you to limit yourself to one per package.
See the example below for more.
+## A Hello World Example
-## Example
+``` lisp
+(asdf:load-system "lazybones-hunchentoot")
+
+(defpackage #:hello-lazybones
+ (:use #:cl)
+ (:local-nicknames (#:lzb #:lazybones))
+ (:import-from #:lazybones #:defendpoint* #:http-ok))
+
+(in-package :hello-lazybones)
+
+(defendpoint* :get "/hello/:name:" ()
+ (http-ok (format nil "Welcome to Lazybones, ~a" name)))
+
+(defvar *my-server* (lzb:create-server))
+(lzb:install-app *my-server* (lzb:app))
+(lzb:start-server *my-server*)
+```
+
+Go ahead and test this sever out with curl:
+
+``` shell
+
+$ curl -v http://localhost:8888/hello/colin
+* Trying 127.0.0.1:8888...
+* Connected to localhost (127.0.0.1) port 8888 (#0)
+> GET /hello/colin HTTP/1.1
+> Host: localhost:8888
+> User-Agent: curl/7.74.0
+> Accept: */*
+>
+* Mark bundle as not supporting multiuse
+< HTTP/1.1 200 OK
+< Content-Length: 27
+< Date: Wed, 09 Feb 2022 12:26:01 GMT
+< Server: Hunchentoot 1.3.0
+< Content-Type: text/html; charset=utf-8
+<
+* Connection #0 to host localhost left intact
+Welcome to Lazybones, colin
+
+```
+
+
+
+## A Showcase Example
-The following is quick example showing a few things that `lazybones` can do.
+The following is quick example showing a few more things that `lazybones` can do.
``` lisp
(asdf:load-system "lazybones-hunchentoot")