From 9e27e583bd64143ed20e8a37fd0c0aa5de1f07b2 Mon Sep 17 00:00:00 2001 From: Colin Okay Date: Wed, 9 Feb 2022 06:29:38 -0600 Subject: added second example to readme --- README.md | 49 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file 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") -- cgit v1.2.3