From b50c03a0b9c2b02c72f63b257f241c1a5d6cd545 Mon Sep 17 00:00:00 2001 From: Tommi Reiman Date: Sun, 9 Sep 2018 21:50:23 +0300 Subject: [PATCH] better docs --- doc/http/default_interceptors.md | 2 +- doc/http/pedestal.md | 4 ++-- doc/http/sieppari.md | 10 ++++++---- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/doc/http/default_interceptors.md b/doc/http/default_interceptors.md index e40e0e34..8d56aa42 100644 --- a/doc/http/default_interceptors.md +++ b/doc/http/default_interceptors.md @@ -4,7 +4,7 @@ [metosin/reitit-interceptors "0.2.1"] ``` -Just like the [ring default middleware](../ring/default_middleware.md), but for interceptors. The default interceptors are: +Just like the [ring default middleware](../ring/default_middleware.md), but for interceptors. ### Parameters handling * `reitit.http.interceptors.parameters/parameters-interceptor` diff --git a/doc/http/pedestal.md b/doc/http/pedestal.md index d5113be3..423740ef 100644 --- a/doc/http/pedestal.md +++ b/doc/http/pedestal.md @@ -1,10 +1,10 @@ # Pedestal -[Pedestal](http://pedestal.io/) is a well known interceptor implmementation for Clojure. To use `reitit-http` with it, we need to change the default routing interceptor into a new one. Currently, there isn't a separate Pedestal-module in reitit, but the examples have the example code how to do this. +[Pedestal](http://pedestal.io/) is a well known interceptor-based web framework for Clojure. To use `reitit-http` with Pedestal, we need to change the default routing interceptor into a new one. Examples projects show how to do this. ## Caveat -`reitit-http` defines Interceptors as `reitit.interceptor/Interceptor`. Compared to Pedestal (2-arity), reitit uses a simplified (1-arity) model for handling errors, described in the [Sieppari README](https://github.com/metosin/sieppari#differences-to-pedestal). +`reitit-http` defines Interceptors as `reitit.interceptor/Interceptor`. Compared to Pedestal 2-arity error handlers, reitit uses a simplified (1-arity) handlers. Differences in error handling are described in the [Sieppari README](https://github.com/metosin/sieppari#differences-to-pedestal). * you can use any [pedestal-style interceptor](http://pedestal.io/reference/interceptors) within reitit router (as Pedestal is executing those anyway) * you can use any reitit-style interceptor that doesn't have `:error`-stage defined diff --git a/doc/http/sieppari.md b/doc/http/sieppari.md index ea979619..b05ecf0e 100644 --- a/doc/http/sieppari.md +++ b/doc/http/sieppari.md @@ -4,11 +4,13 @@ [metosin/reitit-sieppari "0.2.1"] ``` -[Sieppari](https://github.com/metosin/sieppari) is a new and fast interceptor implementation with pluggable async ([core.async](https://github.com/clojure/core.async), [Manifold](https://github.com/ztellman/manifold) and [Promesa](http://funcool.github.io/promesa/latest)). +[Sieppari](https://github.com/metosin/sieppari) is a new and fast interceptor implementation for Clojure, with pluggable async supporting [core.async](https://github.com/clojure/core.async), [Manifold](https://github.com/ztellman/manifold) and [Promesa](http://funcool.github.io/promesa/latest). -To use Sieppari with `reitit-http`, there is `reitit-sieppari` module, which has an `reitit.interceptor.Executor` implementation for Sieppari. All reitit interceptors use the Sieppari Interceptor model, so they work seamlesly together. +To use Sieppari with `reitit-http`, we need to attach a `reitit.interceptor.sieppari/executor` to a `http-router` to compile and execute the interceptor chains. Reitit and Sieppari share the same interceptor model, so all reitit default interceptors work seamlesly together. -Synchronous Ring: +We can use both syncronous ring and [async-ring](https://www.booleanknot.com/blog/2016/07/15/asynchronous-ring.html) with Sieppari. + +## Synchronous Ring ```clj (require '[reitit.http :as http]) @@ -43,7 +45,7 @@ Synchronous Ring: ;=> {:status 200, :body "pong"} ``` -Ring-async: +## Async-ring ```clj (let [respond (promise)]