欢迎大家赞助一杯啤酒🍺 我们准备了下酒菜:Formal mathematics/Isabelle/ML, Formal verification/Coq/ACL2, C++/F#/Lisp
Ring
来自开放百科 - 灰狐
(版本间的差异)
小 (→指南) |
小 (→Middleware) |
||
(未显示1个用户的6个中间版本) | |||
第2行: | 第2行: | ||
==指南== | ==指南== | ||
+ | $ lein new hello-world 和 $ cd hello-world | ||
+ | |||
vim project.clj | vim project.clj | ||
:dependencies [[org.clojure/clojure "1.8.0"] | :dependencies [[org.clojure/clojure "1.8.0"] | ||
第7行: | 第9行: | ||
[ring/ring-jetty-adapter "1.4.0"]]) | [ring/ring-jetty-adapter "1.4.0"]]) | ||
− | $ lein deps | + | $ lein deps 和 $ lein repl |
− | + | ||
− | $ lein repl | + | |
user=> (ns hello-world.core) | user=> (ns hello-world.core) | ||
hello-world.core=> (defn handler [request] | hello-world.core=> (defn handler [request] | ||
第19行: | 第19行: | ||
hello-world.core=> (run-jetty handler {:port 3000}) | hello-world.core=> (run-jetty handler {:port 3000}) | ||
http://localhost:3000/ | http://localhost:3000/ | ||
+ | |||
+ | ==Middleware== | ||
+ | *[https://github.com/magnars/prone prone] Better exception reporting middleware for Ring. | ||
+ | *[https://github.com/ngrunwald/ring-middleware-format ring-middleware-format] | ||
+ | *[https://github.com/magnars/optimus optimus] A Ring middleware for frontend performance optimization. | ||
+ | *[https://github.com/ring-clojure/ring-defaults ring-defaults] | ||
+ | *[https://github.com/ring-clojure/ring-json ring-json] | ||
+ | *[https://github.com/ring-clojure/ring-ssl ring-ssl] managing HTTPS requests | ||
+ | *[https://github.com/ring-clojure/ring-anti-forgery ring-anti-forgery] to prevent CSRF attacks | ||
+ | *[https://github.com/ring-clojure/ring-mock ring-mock] for unit tests | ||
+ | [https://github.com/search?utf8=%E2%9C%93&q=ring+middleware&type=Repositories&ref=searchresults 更多 ring middleware >>>] | ||
==图集== | ==图集== | ||
第24行: | 第35行: | ||
==链接== | ==链接== | ||
*[https://github.com/ring-clojure/ring ring @ github] | *[https://github.com/ring-clojure/ring ring @ github] | ||
+ | *[https://github.com/ring-clojure/ring/wiki/Third-Party-Libraries Third Party Libraries] | ||
[[category:clojure]] | [[category:clojure]] |
2016年5月13日 (五) 06:58的最后版本
Ring 是 Clojure web 应用库,受 Python WSGI 和 Ruby Rack 启发。
目录 |
[编辑] 指南
$ lein new hello-world 和 $ cd hello-world
vim project.clj
:dependencies [[org.clojure/clojure "1.8.0"] [ring/ring-core "1.4.0"] [ring/ring-jetty-adapter "1.4.0"]])
$ lein deps 和 $ lein repl
user=> (ns hello-world.core) hello-world.core=> (defn handler [request] #_=> {:status 200 #_=> :headers {"Content-Type" "text/html"} #_=> :body "Hello World"}) hello-world.core=> (use 'ring.adapter.jetty) hello-world.core=> (use 'hello-world.core) hello-world.core=> (run-jetty handler {:port 3000}) http://localhost:3000/
[编辑] Middleware
- prone Better exception reporting middleware for Ring.
- ring-middleware-format
- optimus A Ring middleware for frontend performance optimization.
- ring-defaults
- ring-json
- ring-ssl managing HTTPS requests
- ring-anti-forgery to prevent CSRF attacks
- ring-mock for unit tests
[编辑] 图集
[编辑] 链接
分享您的观点