Next: Introduction, Previous: (dir), Up: (dir) [Contents][Index]
This is the integral-rest Reference Manual, version 0.1, generated automatically by Declt version 3.0 "Montgomery Scott" on Tue Dec 22 13:52:52 2020 GMT+0.
• Introduction | What integral-rest is all about | |
• Systems | The systems documentation | |
• Modules | The modules documentation | |
• Files | The files documentation | |
• Packages | The packages documentation | |
• Definitions | The symbols documentation | |
• Indexes | Concepts, functions, variables and data types |
(defclass user ()
((id :initarg :id
:primary-key t)
(name :initarg :name))
(:metaclass <dao-table-class>))
(set-rest-app)
(clack:clackup *rest-app*)
(ql:quickload :integral-rest)
(defclass user ()
((id :initarg :id
:primary-key t
:accessor user-id)
(name :initarg :name
:accessor user-name))
(:metaclass integral:<dao-table-class>))
(set-rest-app)
;; This sets REST API app to *rest-app*.
(defvar *my-rest-app* (set-rest-app))
;; (set-rest-app) also returns REST API app.
(set-rest-app (list (find-class 'user)))
;; (set-rest-app) can take list of class. (optional)
*rest-app*
."/api/users" :GET
"/api/users" :POST
"/api/users/:id" :GET
"/api/users/:id" :PUT
"/api/users/:id" :DELETE
(defpackage sample
(:use :cl
:integral
:integral-rest))
(in-package :sample)
(connect-toplevel :sqlite3 :database-name ":memory:")
(defclass user ()
((id :initarg :id
:type integer
:primary-key t
:accessor user-id)
(name :initarg :name
:type string
:accessor user-name))
(:metaclass integral:<dao-table-class>))
(ensure-table-exists (find-class 'user))
(set-rest-app)
(clack:clackup *rest-app*)
;; => Listening on localhost:5000.
(create-dao 'user :name "Rudolph")
;; => #<USER id: 1>
(dex:get "http://localhost:5000/api/users")
;; => "[{\"id\":1,\"name\":\"Rudolph\"}]"
(dex:get "http://localhost:5000/api/users/1")
;; => "{\"id\":1,\"name\":\"Rudolph\"}"
(dex:post "http://localhost:5000/api/users" :content '(("name" . "Miller")))
;; => "{\"id\":2,\"name\":\"Miller\"}"
(find-dao 'user 2)
;; => #<USER id: 2 name: "Miller">
(dex:put "http://localhost:5000/api/users/2" :content '(("name" . "Tom")))
;; => "{\"id\":2,\"name\":\"Tom\"}"
(find-dao 'user 2)
;; => #<USER id: 2 name: "Tom">
(dex:delete "http://localhost:5000/api/users/2")
;; => "{\"id\":2,\"name\":\"Tom\"}"
(find-dao 'user 2)
;; => NIL
(defclass user ()
((id :initarg :id
:primary-key t
:accessor user-id)
(name :initarg :name
:accessor user-name))
(:metaclass integral:<dao-table-class>))
(set-rest-app)
(routing-rules *rest-app*)
;; => '(("/api/users" :GET) ("/api/users" :POST) ("/api/users/:id" :GET)
;; ("/api/users/:id" :PUT) ("/api/users/:id" :DELETE))
Copyright (c) 2015 Rudolph-Miller
Licensed under the MIT License.
Next: Modules, Previous: Introduction, Up: Top [Contents][Index]
The main system appears first, followed by any subsystem dependency.
• The integral-rest system |
Rudolph-Miller
MIT
REST APIs for Integral DAO Table.
# Integral-Rest - REST APIs for Integral DAO Table.
[](https://circleci.com/gh/Rudolph-Miller/integral-rest)
[](http://quickdocs.org/integral-rest/)
## Usage
“‘Lisp
(defclass user ()
((id :initarg :id
:primary-key t)
(name :initarg :name))
(:metaclass <dao-table-class>))
(set-rest-app)
(clack:clackup *rest-app*)
“‘
## Installation
“‘Lisp
(ql:quickload :integral-rest)
“‘
## API
### set-rest-app
“‘Lisp
(defclass user ()
((id :initarg :id
:primary-key t
:accessor user-id)
(name :initarg :name
:accessor user-name))
(:metaclass integral:<dao-table-class>))
(set-rest-app)
;; This sets REST API app to *rest-app*.
(defvar *my-rest-app* (set-rest-app))
;; (set-rest-app) also returns REST API app.
(set-rest-app (list (find-class ’user)))
;; (set-rest-app) can take list of class. (optional)
“‘
- sets REST API app to ‘*rest-app*‘.
- returns REST API app.
- REST API app has these routing rules below.
- ‘"/api/users" :GET‘
- ‘"/api/users" :POST‘
- ‘"/api/users/:id" :GET‘
- ‘"/api/users/:id" :PUT‘
- ‘"/api/users/:id" :DELETE‘
“‘Lisp
(defpackage sample
(:use :cl
:integral
:integral-rest))
(in-package :sample)
(connect-toplevel :sqlite3 :database-name ":memory:")
(defclass user ()
((id :initarg :id
:type integer
:primary-key t
:accessor user-id)
(name :initarg :name
:type string
:accessor user-name))
(:metaclass integral:<dao-table-class>))
(ensure-table-exists (find-class ’user))
(set-rest-app)
(clack:clackup *rest-app*)
;; => Listening on localhost:5000.
(create-dao ’user :name "Rudolph")
;; => #<USER id: 1>
(dex:get "http://localhost:5000/api/users")
;; => "[{\"id\":1,\"name\":\"Rudolph\"}]"
(dex:get "http://localhost:5000/api/users/1")
;; => "{\"id\":1,\"name\":\"Rudolph\"}"
(dex:post "http://localhost:5000/api/users" :content ’(("name" . "Miller")))
;; => "{\"id\":2,\"name\":\"Miller\"}"
(find-dao ’user 2)
;; => #<USER id: 2 name: "Miller">
(dex:put "http://localhost:5000/api/users/2" :content ’(("name" . "Tom")))
;; => "{\"id\":2,\"name\":\"Tom\"}"
(find-dao ’user 2)
;; => #<USER id: 2 name: "Tom">
(dex:delete "http://localhost:5000/api/users/2")
;; => "{\"id\":2,\"name\":\"Tom\"}"
(find-dao ’user 2)
;; => NIL
“‘
### routing-rules
“‘Lisp
(defclass user ()
((id :initarg :id
:primary-key t
:accessor user-id)
(name :initarg :name
:accessor user-name))
(:metaclass integral:<dao-table-class>))
(set-rest-app)
(routing-rules *rest-app*)
;; => ’(("/api/users" :GET) ("/api/users" :POST) ("/api/users/:id" :GET)
;; ("/api/users/:id" :PUT) ("/api/users/:id" :DELETE))
“‘
- returns list of routing rules the app has.
## Author
* Rudolph-Miller
## See Also
- [Integral](https://github.com/fukamachi/integral)
## Copyright
Copyright (c) 2015 Rudolph-Miller
## License
Licensed under the MIT License.
0.1
integral-rest.asd (file)
src (module)
Modules are listed depth-first from the system components tree.
• The integral-rest/src module |
integral-rest (system)
src/
Files are sorted by type and then listed depth-first from the systems components trees.
• Lisp files |
• The integral-rest.asd file | ||
• The integral-rest/src/integral-rest.lisp file | ||
• The integral-rest/src/route.lisp file | ||
• The integral-rest/src/api.lisp file | ||
• The integral-rest/src/util.lisp file |
Next: The integral-rest/src/integral-rest․lisp file, Previous: Lisp files, Up: Lisp files [Contents][Index]
integral-rest.asd
integral-rest (system)
Next: The integral-rest/src/route․lisp file, Previous: The integral-rest․asd file, Up: Lisp files [Contents][Index]
src (module)
src/integral-rest.lisp
<app> (class)
Next: The integral-rest/src/api․lisp file, Previous: The integral-rest/src/integral-rest․lisp file, Up: Lisp files [Contents][Index]
src (module)
src/route.lisp
Next: The integral-rest/src/util․lisp file, Previous: The integral-rest/src/route․lisp file, Up: Lisp files [Contents][Index]
Previous: The integral-rest/src/api․lisp file, Up: Lisp files [Contents][Index]
src (module)
src/util.lisp
Next: Definitions, Previous: Files, Up: Top [Contents][Index]
Packages are listed by definition order.
• The integral-rest-asd package | ||
• The integral-rest package | ||
• The integral-rest.route package | ||
• The integral-rest.api package | ||
• The integral-rest.util package |
Next: The integral-rest package, Previous: Packages, Up: Packages [Contents][Index]
integral-rest.asd
Next: The integral-rest․route package, Previous: The integral-rest-asd package, Up: Packages [Contents][Index]
integral-rest.lisp (file)
<app> (class)
Next: The integral-rest․api package, Previous: The integral-rest package, Up: Packages [Contents][Index]
route.lisp (file)
Next: The integral-rest․util package, Previous: The integral-rest․route package, Up: Packages [Contents][Index]
api.lisp (file)
Previous: The integral-rest․api package, Up: Packages [Contents][Index]
util.lisp (file)
Definitions are sorted by export status, category, package, and then by lexicographic order.
• Exported definitions | ||
• Internal definitions |
Next: Internal definitions, Previous: Definitions, Up: Definitions [Contents][Index]
• Exported special variables | ||
• Exported functions | ||
• Exported generic functions |
Next: Exported functions, Previous: Exported definitions, Up: Exported definitions [Contents][Index]
route.lisp (file)
route.lisp (file)
util.lisp (file)
route.lisp (file)
integral-rest.lisp (file)
Next: Exported generic functions, Previous: Exported special variables, Up: Exported definitions [Contents][Index]
returns list of routing rules the app has.
integral-rest.lisp (file)
sets REST API app to *rest-app* and returns REST API app.
integral-rest.lisp (file)
util.lisp (file)
Previous: Exported functions, Up: Exported definitions [Contents][Index]
route.lisp (file)
util.lisp (file)
api.lisp (file)
route.lisp (file)
route.lisp (file)
api.lisp (file)
route.lisp (file)
route.lisp (file)
util.lisp (file)
util.lisp (file)
Previous: Exported definitions, Up: Definitions [Contents][Index]
• Internal functions | ||
• Internal classes |
Next: Internal classes, Previous: Internal definitions, Up: Internal definitions [Contents][Index]
route.lisp (file)
route.lisp (file)
route.lisp (file)
Previous: Internal functions, Up: Internal definitions [Contents][Index]
integral-rest.lisp (file)
app (class)
Previous: Definitions, Up: Top [Contents][Index]
• Concept index | ||
• Function index | ||
• Variable index | ||
• Data type index |
Next: Function index, Previous: Indexes, Up: Indexes [Contents][Index]
Jump to: | F I L M |
---|
Jump to: | F I L M |
---|
Next: Variable index, Previous: Concept index, Up: Indexes [Contents][Index]
Jump to: | A F G K M P R S T |
---|
Jump to: | A F G K M P R S T |
---|
Next: Data type index, Previous: Function index, Up: Indexes [Contents][Index]
Jump to: | *
S |
---|
Jump to: | *
S |
---|
Previous: Variable index, Up: Indexes [Contents][Index]
Jump to: | <
C I P S |
---|
Jump to: | <
C I P S |
---|