Browse code
chore: more documentation
Ed Langley authored on 29/08/2019 18:56:48
Showing 2 changed files
Showing 2 changed files
... | ... |
@@ -2,9 +2,16 @@ |
2 | 2 |
|
3 | 3 |
* Setup |
4 | 4 |
|
5 |
- - src_sh{git clone https://github.com/fiddlerwoaroof/data-lens.git ~/quicklisp/local-projects/data-lens} |
|
6 |
- - src_sh{git clone https://github.com/fukamachi/lack.git ~/quicklisp/local-projects/lack} |
|
7 |
- - src_sh{sbcl --eval '(asdf:load-asd (truename "todo-backend.asd"))' --eval '(ql:quickload :todo-backend)' --eval '(fwoar.todo::ensure-started)'} |
|
5 |
+ - src_sh[:exports code]{git clone https://github.com/fiddlerwoaroof/data-lens.git ~/quicklisp/local-projects/data-lens} |
|
6 |
+ - src_sh[:exports code]{git clone https://github.com/fukamachi/lack.git ~/quicklisp/local-projects/lack} |
|
7 |
+ |
|
8 |
+ #+BEGIN_SRC sh |
|
9 |
+ sbcl --eval '(asdf:load-asd (truename "todo-backend.asd"))' |
|
10 |
+ --eval '(ql:quickload :todo-backend)' |
|
11 |
+ --eval '(fwoar.todo::ensure-started)' |
|
12 |
+ #+END_SRC |
|
13 |
+ |
|
14 |
+ After this, all the tests [[http://www.todobackend.com/specs/index.html?http://localhost:5000][here]] should pass and the frontend [[http://www.todobackend.com/client/index.html?http://localhost:5000][here]] should work. |
|
8 | 15 |
|
9 | 16 |
* todo API |
10 | 17 |
|
... | ... |
@@ -3,7 +3,7 @@ |
3 | 3 |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
4 | 4 |
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> |
5 | 5 |
<head> |
6 |
-<!-- 2019-08-29 Thu 13:34 --> |
|
6 |
+<!-- 2019-08-29 Thu 13:51 --> |
|
7 | 7 |
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> |
8 | 8 |
<meta name="viewport" content="width=device-width, initial-scale=1" /> |
9 | 9 |
<title>TODO backend implementation using CL and fukamachi/ningle</title> |
... | ... |
@@ -285,41 +285,49 @@ for the JavaScript code in this tag. |
285 | 285 |
<h2>Table of Contents</h2> |
286 | 286 |
<div id="text-table-of-contents"> |
287 | 287 |
<ul> |
288 |
-<li><a href="#orge5b67bc">1. Setup</a></li> |
|
289 |
-<li><a href="#orgc8a4f36">2. todo API</a> |
|
288 |
+<li><a href="#org4335b3f">1. Setup</a></li> |
|
289 |
+<li><a href="#orgd9badd7">2. todo API</a> |
|
290 | 290 |
<ul> |
291 |
-<li><a href="#orgd5eb315">2.1. List-level APIs</a></li> |
|
292 |
-<li><a href="#orgabe7968">2.2. Getting/Replacing a todo</a></li> |
|
293 |
-<li><a href="#org5db19b9">2.3. Adding and modifying todos</a></li> |
|
294 |
-<li><a href="#org9ad7e12">2.4. Examples</a></li> |
|
291 |
+<li><a href="#org28e1af7">2.1. List-level APIs</a></li> |
|
292 |
+<li><a href="#orgdb74c86">2.2. Getting/Replacing a todo</a></li> |
|
293 |
+<li><a href="#org0c6b1ff">2.3. Adding and modifying todos</a></li> |
|
294 |
+<li><a href="#org3a3c9b0">2.4. Examples</a></li> |
|
295 | 295 |
</ul> |
296 | 296 |
</li> |
297 |
-<li><a href="#org78dfe6a">3. Source</a> |
|
297 |
+<li><a href="#orgec2861c">3. Source</a> |
|
298 | 298 |
<ul> |
299 |
-<li><a href="#org1dcbc47">3.1. model.lisp source code</a></li> |
|
300 |
-<li><a href="#org2bf9be6">3.2. routing.lisp source</a></li> |
|
301 |
-<li><a href="#org2763c00">3.3. main.lisp source</a></li> |
|
299 |
+<li><a href="#org98cfbdd">3.1. model.lisp source code</a></li> |
|
300 |
+<li><a href="#orgd68289a">3.2. routing.lisp source</a></li> |
|
301 |
+<li><a href="#org54c59b7">3.3. main.lisp source</a></li> |
|
302 | 302 |
</ul> |
303 | 303 |
</li> |
304 | 304 |
</ul> |
305 | 305 |
</div> |
306 | 306 |
</div> |
307 | 307 |
|
308 |
-<div id="outline-container-orge5b67bc" class="outline-2"> |
|
309 |
-<h2 id="orge5b67bc"><span class="section-number-2">1</span> Setup</h2> |
|
308 |
+<div id="outline-container-org4335b3f" class="outline-2"> |
|
309 |
+<h2 id="org4335b3f"><span class="section-number-2">1</span> Setup</h2> |
|
310 | 310 |
<div class="outline-text-2" id="text-1"> |
311 | 311 |
<ul class="org-ul"> |
312 |
-<li></li> |
|
312 |
+<li><code class="src src-sh">git clone https://github.com/fiddlerwoaroof/data-lens.git ~/quicklisp/local-projects/data-lens</code></li> |
|
313 |
+<li><code class="src src-sh">git clone https://github.com/fukamachi/lack.git ~/quicklisp/local-projects/lack</code></li> |
|
314 |
+</ul> |
|
313 | 315 |
|
314 |
-<li></li> |
|
316 |
+<div class="org-src-container"> |
|
317 |
+<pre class="src src-sh">sbcl --eval <span style="color: #D0BF8F;">'(asdf:load-asd (truename "todo-backend.asd"))'</span> |
|
318 |
+ --eval <span style="color: #D0BF8F;">'(ql:quickload :todo-backend)'</span> |
|
319 |
+ --eval <span style="color: #D0BF8F;">'(fwoar.todo::ensure-started)'</span> |
|
320 |
+</pre> |
|
321 |
+</div> |
|
315 | 322 |
|
316 |
-<li></li> |
|
317 |
-</ul> |
|
323 |
+<p> |
|
324 |
+After this, all the tests <a href="http://www.todobackend.com/specs/index.html?http://localhost:5000">here</a> should pass and the frontend <a href="http://www.todobackend.com/client/index.html?http://localhost:5000">here</a> should work. |
|
325 |
+</p> |
|
318 | 326 |
</div> |
319 | 327 |
</div> |
320 | 328 |
|
321 |
-<div id="outline-container-orgc8a4f36" class="outline-2"> |
|
322 |
-<h2 id="orgc8a4f36"><span class="section-number-2">2</span> todo API</h2> |
|
329 |
+<div id="outline-container-orgd9badd7" class="outline-2"> |
|
330 |
+<h2 id="orgd9badd7"><span class="section-number-2">2</span> todo API</h2> |
|
323 | 331 |
<div class="outline-text-2" id="text-2"> |
324 | 332 |
<p> |
325 | 333 |
We use a fairly simple structure for our "database": a fset map (a |
... | ... |
@@ -329,8 +337,8 @@ referenced as <code>*todo*</code>, but this is a detail hidden behind the API. |
329 | 337 |
</p> |
330 | 338 |
</div> |
331 | 339 |
|
332 |
-<div id="outline-container-orgd5eb315" class="outline-3"> |
|
333 |
-<h3 id="orgd5eb315"><span class="section-number-3">2.1</span> List-level APIs</h3> |
|
340 |
+<div id="outline-container-org28e1af7" class="outline-3"> |
|
341 |
+<h3 id="org28e1af7"><span class="section-number-3">2.1</span> List-level APIs</h3> |
|
334 | 342 |
<div class="outline-text-3" id="text-2-1"> |
335 | 343 |
<p> |
336 | 344 |
These are functions for getting the todo list and clearing |
... | ... |
@@ -339,7 +347,7 @@ and <code>clear-todos</code> for DELETE requests. |
339 | 347 |
</p> |
340 | 348 |
|
341 | 349 |
<div class="org-src-container"> |
342 |
-<pre class="src src-lisp" id="org9ed5cd8"><span style="color: #8c8c8c;">(</span><span style="color: #F0DFAF;">defun</span> <span style="color: #8CD0D3;">todos</span> <span style="color: #93a8c6;">()</span> |
|
350 |
+<pre class="src src-lisp" id="org5245d2d"><span style="color: #8c8c8c;">(</span><span style="color: #F0DFAF;">defun</span> <span style="color: #8CD0D3;">todos</span> <span style="color: #93a8c6;">()</span> |
|
343 | 351 |
<span style="color: #93a8c6;">(</span>gmap:gmap <span style="font-weight: bold;">:seq</span> |
344 | 352 |
<span style="color: #b0b1a3;">(</span><span style="color: #F0DFAF;">lambda</span> <span style="color: #97b098;">(</span>_ b<span style="color: #97b098;">)</span> |
345 | 353 |
<span style="color: #97b098;">(</span><span style="color: #F0DFAF;">declare</span> <span style="color: #aebed8;">(</span>ignore _<span style="color: #aebed8;">)</span><span style="color: #97b098;">)</span> |
... | ... |
@@ -354,8 +362,8 @@ and <code>clear-todos</code> for DELETE requests. |
354 | 362 |
</div> |
355 | 363 |
</div> |
356 | 364 |
|
357 |
-<div id="outline-container-orgabe7968" class="outline-3"> |
|
358 |
-<h3 id="orgabe7968"><span class="section-number-3">2.2</span> Getting/Replacing a todo</h3> |
|
365 |
+<div id="outline-container-orgdb74c86" class="outline-3"> |
|
366 |
+<h3 id="orgdb74c86"><span class="section-number-3">2.2</span> Getting/Replacing a todo</h3> |
|
359 | 367 |
<div class="outline-text-3" id="text-2-2"> |
360 | 368 |
<p> |
361 | 369 |
This uses lisp's <a href="http://www.lispworks.com/documentation/HyperSpec/Body/05_a.htm">generalized references</a> to abstract away the |
... | ... |
@@ -365,7 +373,7 @@ the GET request for a specific todo by id. |
365 | 373 |
</p> |
366 | 374 |
|
367 | 375 |
<div class="org-src-container"> |
368 |
-<pre class="src src-lisp" id="org539a4dc"><span style="color: #8c8c8c;">(</span><span style="color: #F0DFAF;">defun</span> <span style="color: #8CD0D3;">todo</span> <span style="color: #93a8c6;">(</span>id<span style="color: #93a8c6;">)</span> |
|
376 |
+<pre class="src src-lisp" id="orgccc29e3"><span style="color: #8c8c8c;">(</span><span style="color: #F0DFAF;">defun</span> <span style="color: #8CD0D3;">todo</span> <span style="color: #93a8c6;">(</span>id<span style="color: #93a8c6;">)</span> |
|
369 | 377 |
<span style="color: #93a8c6;">(</span><span style="color: #F0DFAF;">let</span> <span style="color: #b0b1a3;">(</span><span style="color: #97b098;">(</span>todo <span style="color: #aebed8;">(</span>fset:@ *todos* id<span style="color: #aebed8;">)</span><span style="color: #97b098;">)</span><span style="color: #b0b1a3;">)</span> |
370 | 378 |
todo<span style="color: #93a8c6;">)</span><span style="color: #8c8c8c;">)</span> |
371 | 379 |
|
... | ... |
@@ -381,8 +389,8 @@ the GET request for a specific todo by id. |
381 | 389 |
</div> |
382 | 390 |
</div> |
383 | 391 |
|
384 |
-<div id="outline-container-org5db19b9" class="outline-3"> |
|
385 |
-<h3 id="org5db19b9"><span class="section-number-3">2.3</span> Adding and modifying todos</h3> |
|
392 |
+<div id="outline-container-org0c6b1ff" class="outline-3"> |
|
393 |
+<h3 id="org0c6b1ff"><span class="section-number-3">2.3</span> Adding and modifying todos</h3> |
|
386 | 394 |
<div class="outline-text-3" id="text-2-3"> |
387 | 395 |
<p> |
388 | 396 |
<code>new-todo</code> is fairly trivial. It's main feature is that it has to |
... | ... |
@@ -392,7 +400,7 @@ properly. <code>new-todo</code> backs POST requests to the root endpoint. |
392 | 400 |
</p> |
393 | 401 |
|
394 | 402 |
<div class="org-src-container"> |
395 |
-<pre class="src src-lisp" id="orgd5bb93b"><span style="color: #8c8c8c;">(</span><span style="color: #F0DFAF;">defun</span> <span style="color: #8CD0D3;">new-todo</span> <span style="color: #93a8c6;">(</span>value<span style="color: #93a8c6;">)</span> |
|
403 |
+<pre class="src src-lisp" id="org4ac9cce"><span style="color: #8c8c8c;">(</span><span style="color: #F0DFAF;">defun</span> <span style="color: #8CD0D3;">new-todo</span> <span style="color: #93a8c6;">(</span>value<span style="color: #93a8c6;">)</span> |
|
396 | 404 |
<span style="color: #93a8c6;">(</span><span style="color: #F0DFAF;">let</span> <span style="color: #b0b1a3;">(</span><span style="color: #97b098;">(</span>id <span style="color: #aebed8;">(</span>next-id<span style="color: #aebed8;">)</span><span style="color: #97b098;">)</span><span style="color: #b0b1a3;">)</span> |
397 | 405 |
<span style="color: #b0b1a3;">(</span>setf <span style="color: #97b098;">(</span>todo id<span style="color: #97b098;">)</span> |
398 | 406 |
<span style="color: #97b098;">(</span>alexandria:alist-hash-table |
... | ... |
@@ -412,7 +420,7 @@ todo endpoint for a specific ID. |
412 | 420 |
</p> |
413 | 421 |
|
414 | 422 |
<div class="org-src-container"> |
415 |
-<pre class="src src-lisp" id="orgcb322aa"><span style="color: #8c8c8c;">(</span><span style="color: #F0DFAF;">defun</span> <span style="color: #8CD0D3;">update-todo</span> <span style="color: #93a8c6;">(</span>id v<span style="color: #93a8c6;">)</span> |
|
423 |
+<pre class="src src-lisp" id="orga4002c9"><span style="color: #8c8c8c;">(</span><span style="color: #F0DFAF;">defun</span> <span style="color: #8CD0D3;">update-todo</span> <span style="color: #93a8c6;">(</span>id v<span style="color: #93a8c6;">)</span> |
|
416 | 424 |
<span style="color: #93a8c6;">(</span>setf <span style="color: #b0b1a3;">(</span>todo id<span style="color: #b0b1a3;">)</span> |
417 | 425 |
<span style="color: #b0b1a3;">(</span>serapeum:merge-tables <span style="color: #97b098;">(</span>or <span style="color: #aebed8;">(</span>todo id<span style="color: #aebed8;">)</span> |
418 | 426 |
<span style="color: #aebed8;">(</span>make-hash-table <span style="font-weight: bold;">:test</span> 'equal<span style="color: #aebed8;">)</span><span style="color: #97b098;">)</span> |
... | ... |
@@ -426,8 +434,8 @@ todo endpoint for a specific ID. |
426 | 434 |
</div> |
427 | 435 |
</div> |
428 | 436 |
|
429 |
-<div id="outline-container-org9ad7e12" class="outline-3"> |
|
430 |
-<h3 id="org9ad7e12"><span class="section-number-3">2.4</span> Examples</h3> |
|
437 |
+<div id="outline-container-org3a3c9b0" class="outline-3"> |
|
438 |
+<h3 id="org3a3c9b0"><span class="section-number-3">2.4</span> Examples</h3> |
|
431 | 439 |
<div class="outline-text-3" id="text-2-4"> |
432 | 440 |
<div class="org-src-container"> |
433 | 441 |
<pre class="src src-lisp"><span style="color: #8c8c8c;">(</span><span style="color: #F0DFAF;">in-package</span> <span style="font-weight: bold;">:fwoar.todo</span><span style="color: #8c8c8c;">)</span> |
... | ... |
@@ -442,10 +450,10 @@ todo endpoint for a specific ID. |
442 | 450 |
</div> |
443 | 451 |
|
444 | 452 |
<pre class="example"> |
445 |
-(#<hash-table "url": "http://localhost:5000/todo/77", |
|
453 |
+(#<hash-table "url": "http://localhost:5000/todo/95", |
|
446 | 454 |
"title": "get groceries", |
447 | 455 |
"completed": YASON:FALSE> |
448 |
- #<hash-table "url": "http://localhost:5000/todo/78", |
|
456 |
+ #<hash-table "url": "http://localhost:5000/todo/96", |
|
449 | 457 |
"title": "write-better-documentation", |
450 | 458 |
"completed": YASON:FALSE>) |
451 | 459 |
</pre> |
... | ... |
@@ -453,12 +461,12 @@ todo endpoint for a specific ID. |
453 | 461 |
</div> |
454 | 462 |
</div> |
455 | 463 |
|
456 |
-<div id="outline-container-org78dfe6a" class="outline-2"> |
|
457 |
-<h2 id="org78dfe6a"><span class="section-number-2">3</span> Source</h2> |
|
464 |
+<div id="outline-container-orgec2861c" class="outline-2"> |
|
465 |
+<h2 id="orgec2861c"><span class="section-number-2">3</span> Source</h2> |
|
458 | 466 |
<div class="outline-text-2" id="text-3"> |
459 | 467 |
</div> |
460 |
-<div id="outline-container-org1dcbc47" class="outline-3"> |
|
461 |
-<h3 id="org1dcbc47"><span class="section-number-3">3.1</span> model.lisp source code</h3> |
|
468 |
+<div id="outline-container-org98cfbdd" class="outline-3"> |
|
469 |
+<h3 id="org98cfbdd"><span class="section-number-3">3.1</span> model.lisp source code</h3> |
|
462 | 470 |
<div class="outline-text-3" id="text-3-1"> |
463 | 471 |
<div class="org-src-container"> |
464 | 472 |
<pre class="src src-lisp"><span style="color: #A6A689; background-color: #2B2B2B;">;; </span><span style="color: #A6A689; background-color: #2B2B2B;">[[file:~/git_repos/lisp-sandbox/todo/README.org::package-include][package-include]]</span> |
... | ... |
@@ -540,8 +548,8 @@ todo endpoint for a specific ID. |
540 | 548 |
</div> |
541 | 549 |
</div> |
542 | 550 |
|
543 |
-<div id="outline-container-org2bf9be6" class="outline-3"> |
|
544 |
-<h3 id="org2bf9be6"><span class="section-number-3">3.2</span> routing.lisp source</h3> |
|
551 |
+<div id="outline-container-orgd68289a" class="outline-3"> |
|
552 |
+<h3 id="orgd68289a"><span class="section-number-3">3.2</span> routing.lisp source</h3> |
|
545 | 553 |
<div class="outline-text-3" id="text-3-2"> |
546 | 554 |
<div class="org-src-container"> |
547 | 555 |
<pre class="src src-lisp"><span style="color: #8c8c8c;">(</span><span style="color: #F0DFAF;">in-package</span> <span style="font-weight: bold;">:fwoar.todo</span><span style="color: #8c8c8c;">)</span> |
... | ... |
@@ -587,8 +595,8 @@ todo endpoint for a specific ID. |
587 | 595 |
</div> |
588 | 596 |
</div> |
589 | 597 |
|
590 |
-<div id="outline-container-org2763c00" class="outline-3"> |
|
591 |
-<h3 id="org2763c00"><span class="section-number-3">3.3</span> main.lisp source</h3> |
|
598 |
+<div id="outline-container-org54c59b7" class="outline-3"> |
|
599 |
+<h3 id="org54c59b7"><span class="section-number-3">3.3</span> main.lisp source</h3> |
|
592 | 600 |
<div class="outline-text-3" id="text-3-3"> |
593 | 601 |
<div class="org-src-container"> |
594 | 602 |
<pre class="src src-lisp"><span style="color: #8c8c8c;">(</span><span style="color: #F0DFAF;">in-package</span> <span style="font-weight: bold;">:fwoar.todo</span><span style="color: #8c8c8c;">)</span> |
... | ... |
@@ -634,7 +642,7 @@ todo endpoint for a specific ID. |
634 | 642 |
</div> |
635 | 643 |
<div id="postamble" class="status"> |
636 | 644 |
<p class="author">Author: Langley</p> |
637 |
-<p class="date">Created: 2019-08-29 Thu 13:34</p> |
|
645 |
+<p class="date">Created: 2019-08-29 Thu 13:51</p> |
|
638 | 646 |
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p> |
639 | 647 |
</div> |
640 | 648 |
</body> |