Next: Introduction, Previous: (dir), Up: (dir) [Contents][Index]
This is the myway Reference Manual, version 0.1.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Mon Aug 15 05:26:25 2022 GMT+0.
Next: Systems, Previous: The myway Reference Manual, Up: The myway Reference Manual [Contents][Index]
My Way is a Sinatra-compatible URL routing library. This was originally written as Clack.Util.Route, a part of Clack.
(use-package :myway)
(defvar *mapper* (make-mapper))
(connect *mapper* "/" "Welcome to My Way.")
(connect *mapper* "/hello/?:name?"
(lambda (params)
(format nil "Hello, ~A" (or (getf params :name)
"Guest"))))
(dispatch *mapper* "/")
;=> "Welcome to My Way."
; T
(dispatch *mapper* "/hello")
;=> "Hello, Guest"
; T
(dispatch *mapper* "/hello/Eitaro")
;=> "Hello, Eitaro"
; T
(dispatch *mapper* "/hello/Eitaro" :method :POST)
;=> NIL
; NIL
(connect *mapper* "/guess/:who"
(lambda (params)
(if (string= (getf params :who) "Eitaro")
"You got me!"
(next-route))))
(connect *mapper* "/guess/*"
(lambda (params)
(declare (ignore params))
"You missed!"))
to-app
makes a Clack app from mapper
.
(to-app *mapper*)
;=> #<CLOSURE (LAMBDA (MYWAY::ENV) :IN TO-APP) {100E24F13B}>
(clack:clackup (to-app *mapper*))
(ql:quickload :myway)
Copyright (c) 2014 Eitaro Fukamachi (e.arrows@gmail.com)
Licensed under the LLGPL License.
Next: Modules, Previous: Introduction, Up: The myway Reference Manual [Contents][Index]
The main system appears first, followed by any subsystem dependency.
Sinatra-compatible routing library.
Eitaro Fukamachi
LLGPL
# My Way
My Way is a Sinatra-compatible URL routing library. This was originally written as Clack.Util.Route, a part of [Clack](http://clacklisp.org/).
## Usage
“‘common-lisp
(use-package :myway)
(defvar *mapper* (make-mapper))
(connect *mapper* "/" "Welcome to My Way.")
(connect *mapper* "/hello/?:name?"
(lambda (params)
(format nil "Hello, ~A" (or (getf params :name)
"Guest"))))
(dispatch *mapper* "/")
;=> "Welcome to My Way."
; T
(dispatch *mapper* "/hello")
;=> "Hello, Guest"
; T
(dispatch *mapper* "/hello/Eitaro")
;=> "Hello, Eitaro"
; T
(dispatch *mapper* "/hello/Eitaro" :method :POST)
;=> NIL
; NIL
“‘
### next-route
“‘common-lisp
(connect *mapper* "/guess/:who"
(lambda (params)
(if (string= (getf params :who) "Eitaro")
"You got me!"
(next-route))))
(connect *mapper* "/guess/*"
(lambda (params)
(declare (ignore params))
"You missed!"))
“‘
### to-app
‘to-app‘ makes a Clack app from ‘mapper‘.
“‘common-lisp
(to-app *mapper*)
;=> #<CLOSURE (LAMBDA (MYWAY::ENV) :IN TO-APP) {100E24F13B}>
(clack:clackup (to-app *mapper*))
“‘
## Installation
“‘common-lisp
(ql:quickload :myway)
“‘
## Author
* Eitaro Fukamachi (e.arrows@gmail.com)
## Copyright
Copyright (c) 2014 Eitaro Fukamachi (e.arrows@gmail.com)
## License
Licensed under the LLGPL License.
0.1.0
src (module).
Next: Files, Previous: Systems, Up: The myway Reference Manual [Contents][Index]
Modules are listed depth-first from the system components tree.
myway (system).
Next: Packages, Previous: Modules, Up: The myway Reference Manual [Contents][Index]
Files are sorted by type and then listed depth-first from the systems components trees.
Next: myway/src/rule.lisp, Previous: myway/myway.asd, Up: Lisp [Contents][Index]
src (module).
Next: myway/src/route.lisp, Previous: myway/src/myway.lisp, Up: Lisp [Contents][Index]
src (module).
Next: myway/src/mapper.lisp, Previous: myway/src/rule.lisp, Up: Lisp [Contents][Index]
rule.lisp (file).
src (module).
Next: myway/src/util.lisp, Previous: myway/src/route.lisp, Up: Lisp [Contents][Index]
src (module).
Previous: myway/src/mapper.lisp, Up: Lisp [Contents][Index]
src (module).
make-collector (function).
Next: Definitions, Previous: Files, Up: The myway Reference Manual [Contents][Index]
Packages are listed by definition order.
Next: myway.rule, Previous: Packages, Up: Packages [Contents][Index]
common-lisp.
make-collector (function).
Next: myway, Previous: myway.util, Up: Packages [Contents][Index]
common-lisp.
Next: myway.route, Previous: myway.rule, Up: Packages [Contents][Index]
common-lisp.
common-lisp.
Next: myway.mapper, Previous: myway.route, Up: Packages [Contents][Index]
common-lisp.
Next: Indexes, Previous: Packages, Up: The myway Reference Manual [Contents][Index]
Definitions are sorted by export status, category, package, and then by lexicographic order.
Next: Internals, Previous: Definitions, Up: Definitions [Contents][Index]
Next: Ordinary functions, Previous: Public Interface, Up: Public Interface [Contents][Index]
Next: Generic functions, Previous: Special variables, Up: Public Interface [Contents][Index]
Next: Standalone methods, Previous: Ordinary functions, Up: Public Interface [Contents][Index]
Next: Structures, Previous: Generic functions, Up: Public Interface [Contents][Index]
Next: Classes, Previous: Standalone methods, Up: Public Interface [Contents][Index]
structure-object.
(myway.util:make-collector)
structure-object.
map-set:map-set
myway.rule::*default-rule-methods*
Previous: Structures, Up: Public Interface [Contents][Index]
Previous: Public Interface, Up: Definitions [Contents][Index]
Next: Ordinary functions, Previous: Internals, Up: Internals [Contents][Index]
Previous: Special variables, Up: Internals [Contents][Index]
Previous: Definitions, Up: The myway Reference Manual [Contents][Index]
Jump to: | %
(
A C D E F G I L M N R T U |
---|
Jump to: | %
(
A C D E F G I L M N R T U |
---|
Next: Data types, Previous: Functions, Up: Indexes [Contents][Index]
Jump to: | %
*
F H M N P R S U |
---|
Jump to: | %
*
F H M N P R S U |
---|
Jump to: | C F M P R S U |
---|
Jump to: | C F M P R S U |
---|