mirror of
https://github.com/metosin/reitit.git
synced 2025-12-28 12:18:25 +00:00
Delete outdated files [skip ci]
This commit is contained in:
parent
71d96d3161
commit
cf77d3d645
83 changed files with 47 additions and 17749 deletions
|
|
@ -1189,7 +1189,7 @@
|
|||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Composing Routers","level":"7.2","depth":1,"next":{"title":"Different Routers","level":"7.3","depth":1,"path":"advanced/different_routers.md","ref":"advanced/different_routers.md","articles":[]},"previous":{"title":"Configuring Routers","level":"7.1","depth":1,"path":"advanced/configuring_routers.md","ref":"advanced/configuring_routers.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"advanced/composing_routers.md","mtime":"2020-01-14T13:47:50.963Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-24T11:08:28.724Z"},"basePath":"..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Composing Routers","level":"7.2","depth":1,"next":{"title":"Different Routers","level":"7.3","depth":1,"path":"advanced/different_routers.md","ref":"advanced/different_routers.md","articles":[]},"previous":{"title":"Configuring Routers","level":"7.1","depth":1,"path":"advanced/configuring_routers.md","ref":"advanced/configuring_routers.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"advanced/composing_routers.md","mtime":"2020-01-14T13:47:50.963Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-28T09:52:25.779Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -903,7 +903,7 @@
|
|||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Configuring Routers","level":"7.1","depth":1,"next":{"title":"Composing Routers","level":"7.2","depth":1,"path":"advanced/composing_routers.md","ref":"advanced/composing_routers.md","articles":[]},"previous":{"title":"Controllers","level":"6.3","depth":1,"path":"frontend/controllers.md","ref":"frontend/controllers.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"advanced/configuring_routers.md","mtime":"2020-01-14T13:47:50.964Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-24T11:08:28.724Z"},"basePath":"..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Configuring Routers","level":"7.1","depth":1,"next":{"title":"Composing Routers","level":"7.2","depth":1,"path":"advanced/composing_routers.md","ref":"advanced/composing_routers.md","articles":[]},"previous":{"title":"Controllers","level":"6.3","depth":1,"path":"frontend/controllers.md","ref":"frontend/controllers.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"advanced/configuring_routers.md","mtime":"2020-01-14T13:47:50.964Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-28T09:52:25.779Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -954,7 +954,7 @@
|
|||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Dev Workflow","level":"7.5","depth":1,"next":{"title":"Shared Routes","level":"7.6","depth":1,"path":"advanced/shared_routes.md","ref":"advanced/shared_routes.md","articles":[]},"previous":{"title":"Route Validation","level":"7.4","depth":1,"path":"advanced/route_validation.md","ref":"advanced/route_validation.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"advanced/dev_workflow.md","mtime":"2020-01-14T13:47:50.965Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-24T11:08:28.724Z"},"basePath":"..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Dev Workflow","level":"7.5","depth":1,"next":{"title":"Shared Routes","level":"7.6","depth":1,"path":"advanced/shared_routes.md","ref":"advanced/shared_routes.md","articles":[]},"previous":{"title":"Route Validation","level":"7.4","depth":1,"path":"advanced/route_validation.md","ref":"advanced/route_validation.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"advanced/dev_workflow.md","mtime":"2020-01-14T13:47:50.965Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-28T09:52:25.779Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -902,7 +902,7 @@
|
|||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Different Routers","level":"7.3","depth":1,"next":{"title":"Route Validation","level":"7.4","depth":1,"path":"advanced/route_validation.md","ref":"advanced/route_validation.md","articles":[]},"previous":{"title":"Composing Routers","level":"7.2","depth":1,"path":"advanced/composing_routers.md","ref":"advanced/composing_routers.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"advanced/different_routers.md","mtime":"2020-01-14T13:47:50.966Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-24T11:08:28.724Z"},"basePath":"..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Different Routers","level":"7.3","depth":1,"next":{"title":"Route Validation","level":"7.4","depth":1,"path":"advanced/route_validation.md","ref":"advanced/route_validation.md","articles":[]},"previous":{"title":"Composing Routers","level":"7.2","depth":1,"path":"advanced/composing_routers.md","ref":"advanced/composing_routers.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"advanced/different_routers.md","mtime":"2020-01-14T13:47:50.966Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-28T09:52:25.779Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,839 +0,0 @@
|
|||
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="" >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>Advanced · GitBook</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="description" content="">
|
||||
<meta name="generator" content="GitBook 3.2.3">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/style.css">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta name="HandheldFriendly" content="true"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
|
||||
<link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
|
||||
|
||||
|
||||
<link rel="next" href="configuring_routers.html" />
|
||||
|
||||
|
||||
<link rel="prev" href="../ring/swagger.html" />
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="book">
|
||||
<div class="book-summary">
|
||||
|
||||
|
||||
<div id="book-search-input" role="search">
|
||||
<input type="text" placeholder="Type to search" />
|
||||
</div>
|
||||
|
||||
|
||||
<nav role="navigation">
|
||||
|
||||
|
||||
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1" data-path="../">
|
||||
|
||||
<a href="../">
|
||||
|
||||
|
||||
Introduction
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2" data-path="../basics/">
|
||||
|
||||
<a href="../basics/">
|
||||
|
||||
|
||||
Basics
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.2.1" data-path="../basics/route_syntax.html">
|
||||
|
||||
<a href="../basics/route_syntax.html">
|
||||
|
||||
|
||||
Route Syntax
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.2" data-path="../basics/router.html">
|
||||
|
||||
<a href="../basics/router.html">
|
||||
|
||||
|
||||
Router
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.3" data-path="../basics/path_based_routing.html">
|
||||
|
||||
<a href="../basics/path_based_routing.html">
|
||||
|
||||
|
||||
Path-based Routing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.4" data-path="../basics/name_based_routing.html">
|
||||
|
||||
<a href="../basics/name_based_routing.html">
|
||||
|
||||
|
||||
Name-based Routing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.5" data-path="../basics/route_data.html">
|
||||
|
||||
<a href="../basics/route_data.html">
|
||||
|
||||
|
||||
Route Data
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.6" data-path="../basics/route_data_validation.html">
|
||||
|
||||
<a href="../basics/route_data_validation.html">
|
||||
|
||||
|
||||
Route Data Validation
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.7" data-path="../basics/route_conflicts.html">
|
||||
|
||||
<a href="../basics/route_conflicts.html">
|
||||
|
||||
|
||||
Route Conflicts
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3" data-path="../coercion/">
|
||||
|
||||
<a href="../coercion/">
|
||||
|
||||
|
||||
Coercion
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.3.1" data-path="../coercion/coercion.html">
|
||||
|
||||
<a href="../coercion/coercion.html">
|
||||
|
||||
|
||||
Coercion Explained
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.2" data-path="../coercion/schema_coercion.html">
|
||||
|
||||
<a href="../coercion/schema_coercion.html">
|
||||
|
||||
|
||||
Plumatic Schema
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.3" data-path="../coercion/clojure_spec_coercion.html">
|
||||
|
||||
<a href="../coercion/clojure_spec_coercion.html">
|
||||
|
||||
|
||||
Clojure.spec
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.4" data-path="../coercion/data_spec_coercion.html">
|
||||
|
||||
<a href="../coercion/data_spec_coercion.html">
|
||||
|
||||
|
||||
Data-specs
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4" data-path="../ring/">
|
||||
|
||||
<a href="../ring/">
|
||||
|
||||
|
||||
Ring
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.4.1" data-path="../ring/ring.html">
|
||||
|
||||
<a href="../ring/ring.html">
|
||||
|
||||
|
||||
Ring-router
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.2" data-path="../ring/reverse_routing.html">
|
||||
|
||||
<a href="../ring/reverse_routing.html">
|
||||
|
||||
|
||||
Reverse-routing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.3" data-path="../ring/default_handler.html">
|
||||
|
||||
<a href="../ring/default_handler.html">
|
||||
|
||||
|
||||
Default handler
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.4" data-path="../ring/static.html">
|
||||
|
||||
<a href="../ring/static.html">
|
||||
|
||||
|
||||
Static Resources
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.5" data-path="../ring/dynamic_extensions.html">
|
||||
|
||||
<a href="../ring/dynamic_extensions.html">
|
||||
|
||||
|
||||
Dynamic Extensions
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.6" data-path="../ring/data_driven_middleware.html">
|
||||
|
||||
<a href="../ring/data_driven_middleware.html">
|
||||
|
||||
|
||||
Data-driven Middleware
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.7" data-path="../ring/transforming_middleware_chain.html">
|
||||
|
||||
<a href="../ring/transforming_middleware_chain.html">
|
||||
|
||||
|
||||
Transforming Middleware Chain
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.8" data-path="../ring/middleware_registry.html">
|
||||
|
||||
<a href="../ring/middleware_registry.html">
|
||||
|
||||
|
||||
Middleware Registry
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.9" data-path="../ring/default_middleware.html">
|
||||
|
||||
<a href="../ring/default_middleware.html">
|
||||
|
||||
|
||||
Default Middleware
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.10" data-path="../ring/coercion.html">
|
||||
|
||||
<a href="../ring/coercion.html">
|
||||
|
||||
|
||||
Pluggable Coercion
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.11" data-path="../ring/route_data_validation.html">
|
||||
|
||||
<a href="../ring/route_data_validation.html">
|
||||
|
||||
|
||||
Route Data Validation
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.12" data-path="../ring/compiling_middleware.html">
|
||||
|
||||
<a href="../ring/compiling_middleware.html">
|
||||
|
||||
|
||||
Compiling Middleware
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.13" data-path="../ring/swagger.html">
|
||||
|
||||
<a href="../ring/swagger.html">
|
||||
|
||||
|
||||
Swagger Support
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter active" data-level="1.5" data-path="./">
|
||||
|
||||
<a href="./">
|
||||
|
||||
|
||||
Advanced
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.5.1" data-path="configuring_routers.html">
|
||||
|
||||
<a href="configuring_routers.html">
|
||||
|
||||
|
||||
Configuring Routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.2" data-path="composing_routers.html">
|
||||
|
||||
<a href="composing_routers.html">
|
||||
|
||||
|
||||
Composing Routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.3" data-path="different_routers.html">
|
||||
|
||||
<a href="different_routers.html">
|
||||
|
||||
|
||||
Different Routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.4" data-path="route_validation.html">
|
||||
|
||||
<a href="route_validation.html">
|
||||
|
||||
|
||||
Route Validation
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.5" data-path="dev_workflow.html">
|
||||
|
||||
<a href="dev_workflow.html">
|
||||
|
||||
|
||||
Dev Workflow
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.6" data-path="../patterns/">
|
||||
|
||||
<a href="../patterns/">
|
||||
|
||||
|
||||
Patterns
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.6.1" data-path="../patterns/shared_routes.html">
|
||||
|
||||
<a href="../patterns/shared_routes.html">
|
||||
|
||||
|
||||
Shared Routes
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.7" data-path="../frontend/">
|
||||
|
||||
<a href="../frontend/">
|
||||
|
||||
|
||||
Frontend
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.7.1" data-path="../frontend/basics.html">
|
||||
|
||||
<a href="../frontend/basics.html">
|
||||
|
||||
|
||||
Basics
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.7.2" data-path="../frontend/browser.html">
|
||||
|
||||
<a href="../frontend/browser.html">
|
||||
|
||||
|
||||
Browser integration
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.7.3" data-path="../frontend/controllers.html">
|
||||
|
||||
<a href="../frontend/controllers.html">
|
||||
|
||||
|
||||
Controllers (WIP)
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.8" data-path="../performance.html">
|
||||
|
||||
<a href="../performance.html">
|
||||
|
||||
|
||||
Performance
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.9" data-path="../interceptors.html">
|
||||
|
||||
<a href="../interceptors.html">
|
||||
|
||||
|
||||
Interceptors (WIP)
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.10" data-path="../development.html">
|
||||
|
||||
<a href="../development.html">
|
||||
|
||||
|
||||
Development Instructions
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.11" data-path="../faq.html">
|
||||
|
||||
<a href="../faq.html">
|
||||
|
||||
|
||||
FAQ
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
<li>
|
||||
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
|
||||
Published with GitBook
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="book-body">
|
||||
|
||||
<div class="body-inner">
|
||||
|
||||
|
||||
|
||||
<div class="book-header" role="navigation">
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
<i class="fa fa-circle-o-notch fa-spin"></i>
|
||||
<a href=".." >Advanced</a>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="page-wrapper" tabindex="-1" role="main">
|
||||
<div class="page-inner">
|
||||
|
||||
<div id="book-search-results">
|
||||
<div class="search-noresults">
|
||||
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<h1 id="advanced">Advanced</h1>
|
||||
<ul>
|
||||
<li><a href="configuring_routers.html">Configuring Routers</a></li>
|
||||
<li><a href="composing_routers.html">Composing Routers</a></li>
|
||||
<li><a href="different_routers.html">Different Routers</a></li>
|
||||
<li><a href="route_validation.html">Route Validation</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
<div class="search-results">
|
||||
<div class="has-results">
|
||||
|
||||
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
|
||||
<ul class="search-results-list"></ul>
|
||||
|
||||
</div>
|
||||
<div class="no-results">
|
||||
|
||||
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<a href="../ring/swagger.html" class="navigation navigation-prev " aria-label="Previous page: Swagger Support">
|
||||
<i class="fa fa-angle-left"></i>
|
||||
</a>
|
||||
|
||||
|
||||
<a href="configuring_routers.html" class="navigation navigation-next " aria-label="Next page: Configuring Routers">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Advanced","level":"1.5","depth":1,"next":{"title":"Configuring Routers","level":"1.5.1","depth":2,"path":"advanced/configuring_routers.md","ref":"advanced/configuring_routers.md","articles":[]},"previous":{"title":"Swagger Support","level":"1.4.13","depth":2,"path":"ring/swagger.md","ref":"ring/swagger.md","articles":[]},"dir":"ltr"},"config":{"plugins":["editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"github":{"url":"https://github.com/metosin/reitit"},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"advanced/README.md","mtime":"2018-09-02T14:52:37.217Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-02T14:53:17.801Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook.js"></script>
|
||||
<script src="../gitbook/theme.js"></script>
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-editlink/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-github/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-search/search.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
@ -1,634 +0,0 @@
|
|||
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="" >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>Interceptors · GitBook</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="description" content="">
|
||||
<meta name="generator" content="GitBook 3.2.3">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/style.css">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta name="HandheldFriendly" content="true"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
|
||||
<link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
|
||||
|
||||
|
||||
<link rel="next" href="../ring/" />
|
||||
|
||||
|
||||
<link rel="prev" href="route_validation.html" />
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="book">
|
||||
<div class="book-summary">
|
||||
|
||||
|
||||
<div id="book-search-input" role="search">
|
||||
<input type="text" placeholder="Type to search" />
|
||||
</div>
|
||||
|
||||
|
||||
<nav role="navigation">
|
||||
|
||||
|
||||
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1" data-path="../">
|
||||
|
||||
<a href="../">
|
||||
|
||||
|
||||
Introduction
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2" data-path="../basics/">
|
||||
|
||||
<a href="../basics/">
|
||||
|
||||
|
||||
Basics
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.2.1" data-path="../basics/route_syntax.html">
|
||||
|
||||
<a href="../basics/route_syntax.html">
|
||||
|
||||
|
||||
Route Syntax
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.2" data-path="../basics/router.html">
|
||||
|
||||
<a href="../basics/router.html">
|
||||
|
||||
|
||||
Router
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.3" data-path="../basics/path_based_routing.html">
|
||||
|
||||
<a href="../basics/path_based_routing.html">
|
||||
|
||||
|
||||
Path-based Routing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.4" data-path="../basics/name_based_routing.html">
|
||||
|
||||
<a href="../basics/name_based_routing.html">
|
||||
|
||||
|
||||
Name-based Routing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.5" data-path="../basics/route_data.html">
|
||||
|
||||
<a href="../basics/route_data.html">
|
||||
|
||||
|
||||
Route Data
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.6" data-path="../basics/route_data_validation.html">
|
||||
|
||||
<a href="../basics/route_data_validation.html">
|
||||
|
||||
|
||||
Route Data Validation
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.7" data-path="../basics/route_conflicts.html">
|
||||
|
||||
<a href="../basics/route_conflicts.html">
|
||||
|
||||
|
||||
Route Conflicts
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3" data-path="../coercion/">
|
||||
|
||||
<a href="../coercion/">
|
||||
|
||||
|
||||
Coercion
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.3.1" data-path="../coercion/coercion.html">
|
||||
|
||||
<a href="../coercion/coercion.html">
|
||||
|
||||
|
||||
Coercion Explained
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.2" data-path="../coercion/schema_coercion.html">
|
||||
|
||||
<a href="../coercion/schema_coercion.html">
|
||||
|
||||
|
||||
Plumatic Schema
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.3" data-path="../coercion/clojure_spec_coercion.html">
|
||||
|
||||
<a href="../coercion/clojure_spec_coercion.html">
|
||||
|
||||
|
||||
Clojure.spec
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.4" data-path="../coercion/data_spec_coercion.html">
|
||||
|
||||
<a href="../coercion/data_spec_coercion.html">
|
||||
|
||||
|
||||
Data-specs
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4" data-path="./">
|
||||
|
||||
<a href="./">
|
||||
|
||||
|
||||
Advanced
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.4.1" data-path="configuring_routers.html">
|
||||
|
||||
<a href="configuring_routers.html">
|
||||
|
||||
|
||||
Configuring Routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.2" data-path="different_routers.html">
|
||||
|
||||
<a href="different_routers.html">
|
||||
|
||||
|
||||
Different Routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.3" data-path="route_validation.html">
|
||||
|
||||
<a href="route_validation.html">
|
||||
|
||||
|
||||
Route Validation
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter active" data-level="1.4.4" data-path="interceptors.html">
|
||||
|
||||
<a href="interceptors.html">
|
||||
|
||||
|
||||
Interceptors
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5" data-path="../ring/">
|
||||
|
||||
<a href="../ring/">
|
||||
|
||||
|
||||
Ring
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.5.1" data-path="../ring/ring.html">
|
||||
|
||||
<a href="../ring/ring.html">
|
||||
|
||||
|
||||
Ring-router
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.2" data-path="../ring/dynamic_extensions.html">
|
||||
|
||||
<a href="../ring/dynamic_extensions.html">
|
||||
|
||||
|
||||
Dynamic Extensions
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.3" data-path="../ring/data_driven_middleware.html">
|
||||
|
||||
<a href="../ring/data_driven_middleware.html">
|
||||
|
||||
|
||||
Data-driven Middleware
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.4" data-path="../ring/coercion.html">
|
||||
|
||||
<a href="../ring/coercion.html">
|
||||
|
||||
|
||||
Pluggable Coercion
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.5" data-path="../ring/route_data_validation.html">
|
||||
|
||||
<a href="../ring/route_data_validation.html">
|
||||
|
||||
|
||||
Route Data Validation
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.6" data-path="../ring/compiling_middleware.html">
|
||||
|
||||
<a href="../ring/compiling_middleware.html">
|
||||
|
||||
|
||||
Compiling Middleware
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.6" data-path="../performance.html">
|
||||
|
||||
<a href="../performance.html">
|
||||
|
||||
|
||||
Performance
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.7" data-path="../faq.html">
|
||||
|
||||
<a href="../faq.html">
|
||||
|
||||
|
||||
FAQ
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.8" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
TODO: Swagger & OpenAPI
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
<li>
|
||||
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
|
||||
Published with GitBook
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="book-body">
|
||||
|
||||
<div class="body-inner">
|
||||
|
||||
|
||||
|
||||
<div class="book-header" role="navigation">
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
<i class="fa fa-circle-o-notch fa-spin"></i>
|
||||
<a href=".." >Interceptors</a>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="page-wrapper" tabindex="-1" role="main">
|
||||
<div class="page-inner">
|
||||
|
||||
<div id="book-search-results">
|
||||
<div class="search-noresults">
|
||||
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<h1 id="interceptors">Interceptors</h1>
|
||||
<p>Reitit also supports <a href="pedestal.io">Pedestal</a>-style <a href="http://pedestal.io/reference/interceptors" target="_blank">interceptors</a>.</p>
|
||||
<h2 id="work-in-progress">work in progress</h2>
|
||||
<ul>
|
||||
<li>port the (coericon) middleware into interceptors</li>
|
||||
<li>separate Clojure(Script) runner?</li>
|
||||
<li>Docs</li>
|
||||
<li>Samples</li>
|
||||
</ul>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
<div class="search-results">
|
||||
<div class="has-results">
|
||||
|
||||
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
|
||||
<ul class="search-results-list"></ul>
|
||||
|
||||
</div>
|
||||
<div class="no-results">
|
||||
|
||||
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<a href="route_validation.html" class="navigation navigation-prev " aria-label="Previous page: Route Validation">
|
||||
<i class="fa fa-angle-left"></i>
|
||||
</a>
|
||||
|
||||
|
||||
<a href="../ring/" class="navigation navigation-next " aria-label="Next page: Ring">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Interceptors","level":"1.4.4","depth":2,"next":{"title":"Ring","level":"1.5","depth":1,"path":"ring/README.md","ref":"ring/README.md","articles":[{"title":"Ring-router","level":"1.5.1","depth":2,"path":"ring/ring.md","ref":"ring/ring.md","articles":[]},{"title":"Dynamic Extensions","level":"1.5.2","depth":2,"path":"ring/dynamic_extensions.md","ref":"ring/dynamic_extensions.md","articles":[]},{"title":"Data-driven Middleware","level":"1.5.3","depth":2,"path":"ring/data_driven_middleware.md","ref":"ring/data_driven_middleware.md","articles":[]},{"title":"Pluggable Coercion","level":"1.5.4","depth":2,"path":"ring/coercion.md","ref":"ring/coercion.md","articles":[]},{"title":"Route Data Validation","level":"1.5.5","depth":2,"path":"ring/route_data_validation.md","ref":"ring/route_data_validation.md","articles":[]},{"title":"Compiling Middleware","level":"1.5.6","depth":2,"path":"ring/compiling_middleware.md","ref":"ring/compiling_middleware.md","articles":[]}]},"previous":{"title":"Route Validation","level":"1.4.3","depth":2,"path":"advanced/route_validation.md","ref":"advanced/route_validation.md","articles":[]},"dir":"ltr"},"config":{"plugins":["editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"github":{"url":"https://github.com/metosin/reitit"},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"advanced/interceptors.md","mtime":"2018-02-02T07:07:37.713Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-02-02T07:08:20.945Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook.js"></script>
|
||||
<script src="../gitbook/theme.js"></script>
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-editlink/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-github/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-search/search.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
@ -1,534 +0,0 @@
|
|||
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="" >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>Route conflicts · GitBook</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="description" content="">
|
||||
<meta name="generator" content="GitBook 3.2.3">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/style.css">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta name="HandheldFriendly" content="true"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
|
||||
<link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
|
||||
|
||||
|
||||
<link rel="next" href="route_validation.html" />
|
||||
|
||||
|
||||
<link rel="prev" href="./" />
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="book">
|
||||
<div class="book-summary">
|
||||
|
||||
|
||||
<div id="book-search-input" role="search">
|
||||
<input type="text" placeholder="Type to search" />
|
||||
</div>
|
||||
|
||||
|
||||
<nav role="navigation">
|
||||
|
||||
|
||||
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1" data-path="../">
|
||||
|
||||
<a href="../">
|
||||
|
||||
|
||||
Introduction
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2" data-path="../basics/">
|
||||
|
||||
<a href="../basics/">
|
||||
|
||||
|
||||
Basics
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.2.1" data-path="../basics/route_syntax.html">
|
||||
|
||||
<a href="../basics/route_syntax.html">
|
||||
|
||||
|
||||
Route syntax
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.2" data-path="../basics/router.html">
|
||||
|
||||
<a href="../basics/router.html">
|
||||
|
||||
|
||||
Router
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.3" data-path="../basics/path_based_routing.html">
|
||||
|
||||
<a href="../basics/path_based_routing.html">
|
||||
|
||||
|
||||
Path-based Routing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.4" data-path="../basics/name_based_routing.html">
|
||||
|
||||
<a href="../basics/name_based_routing.html">
|
||||
|
||||
|
||||
Name-based Routing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.5" data-path="../basics/route_data.html">
|
||||
|
||||
<a href="../basics/route_data.html">
|
||||
|
||||
|
||||
Route data
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.6" data-path="../basics/different_routers.html">
|
||||
|
||||
<a href="../basics/different_routers.html">
|
||||
|
||||
|
||||
Different Routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3" data-path="./">
|
||||
|
||||
<a href="./">
|
||||
|
||||
|
||||
Advanced
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter active" data-level="1.3.1" data-path="route_conflicts.html">
|
||||
|
||||
<a href="route_conflicts.html">
|
||||
|
||||
|
||||
Route conflicts
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.2" data-path="route_validation.html">
|
||||
|
||||
<a href="route_validation.html">
|
||||
|
||||
|
||||
Route Validation
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.3" data-path="configuring_routers.html">
|
||||
|
||||
<a href="configuring_routers.html">
|
||||
|
||||
|
||||
Configuring routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4" data-path="../ring/">
|
||||
|
||||
<a href="../ring/">
|
||||
|
||||
|
||||
Ring
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.4.1" data-path="../ring/ring.html">
|
||||
|
||||
<a href="../ring/ring.html">
|
||||
|
||||
|
||||
Ring-router
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.2" data-path="../ring/dynamic_extensions.html">
|
||||
|
||||
<a href="../ring/dynamic_extensions.html">
|
||||
|
||||
|
||||
Dynamic extensions
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.3" data-path="../ring/parameter_coercion.html">
|
||||
|
||||
<a href="../ring/parameter_coercion.html">
|
||||
|
||||
|
||||
Parameter coercion
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.4" data-path="../ring/compiling_middleware.html">
|
||||
|
||||
<a href="../ring/compiling_middleware.html">
|
||||
|
||||
|
||||
Compiling middleware
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
TODO: Swagger & OpenAPI
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.6" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
TODO: Interceptors
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
<li>
|
||||
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
|
||||
Published with GitBook
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="book-body">
|
||||
|
||||
<div class="body-inner">
|
||||
|
||||
|
||||
|
||||
<div class="book-header" role="navigation">
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
<i class="fa fa-circle-o-notch fa-spin"></i>
|
||||
<a href=".." >Route conflicts</a>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="page-wrapper" tabindex="-1" role="main">
|
||||
<div class="page-inner">
|
||||
|
||||
<div id="book-search-results">
|
||||
<div class="search-noresults">
|
||||
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<h1 id="route-conflicts">Route conflicts</h1>
|
||||
<p>Many routing libraries allow single path lookup could match multiple routes. Usually, first match is used. This is not good, especially if route tree is merged from multiple sources - routes might regress to be unreachable without a warning.</p>
|
||||
<p>Reitit resolves this by running explicit conflicit resolution when a <code>Router</code> is created. Conflicting routes are passed into a <code>:conflicts</code> callback. Default implementation throws <code>ex-info</code> with a descriptive message.</p>
|
||||
<p>Examples routes with conflicts:</p>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name">require</span> '[reitit.core <span class="hljs-symbol">:as</span> reitit])
|
||||
|
||||
(<span class="hljs-name"><span class="hljs-builtin-name">def</span></span> routes
|
||||
[[<span class="hljs-string">"/ping"</span>]
|
||||
[<span class="hljs-string">"/:user-id/orders"</span>]
|
||||
[<span class="hljs-string">"/bulk/:bulk-id"</span>]
|
||||
[<span class="hljs-string">"/public/*path"</span>]
|
||||
[<span class="hljs-string">"/:version/status"</span>]])
|
||||
</code></pre>
|
||||
<p>By default, <code>ExceptionInfo</code> is thrown:</p>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name">reitit/router</span> routes)
|
||||
<span class="hljs-comment">; CompilerException clojure.lang.ExceptionInfo: Router contains conflicting routes:</span>
|
||||
<span class="hljs-comment">;</span>
|
||||
<span class="hljs-comment">; /:user-id/orders</span>
|
||||
<span class="hljs-comment">; -> /public/*path</span>
|
||||
<span class="hljs-comment">; -> /bulk/:bulk-id</span>
|
||||
<span class="hljs-comment">;</span>
|
||||
<span class="hljs-comment">; /bulk/:bulk-id</span>
|
||||
<span class="hljs-comment">; -> /:version/status</span>
|
||||
<span class="hljs-comment">;</span>
|
||||
<span class="hljs-comment">; /public/*path</span>
|
||||
<span class="hljs-comment">; -> /:version/status</span>
|
||||
<span class="hljs-comment">;</span>
|
||||
</code></pre>
|
||||
<p>Just logging the conflicts:</p>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name">reitit/router</span>
|
||||
routes
|
||||
{<span class="hljs-symbol">:conflicts</span> (<span class="hljs-name"><span class="hljs-builtin-name">comp</span></span> println reitit/conflicts-str)})
|
||||
<span class="hljs-comment">; Router contains conflicting routes:</span>
|
||||
<span class="hljs-comment">;</span>
|
||||
<span class="hljs-comment">; /:user-id/orders</span>
|
||||
<span class="hljs-comment">; -> /public/*path</span>
|
||||
<span class="hljs-comment">; -> /bulk/:bulk-id</span>
|
||||
<span class="hljs-comment">;</span>
|
||||
<span class="hljs-comment">; /bulk/:bulk-id</span>
|
||||
<span class="hljs-comment">; -> /:version/status</span>
|
||||
<span class="hljs-comment">;</span>
|
||||
<span class="hljs-comment">; /public/*path</span>
|
||||
<span class="hljs-comment">; -> /:version/status</span>
|
||||
<span class="hljs-comment">;</span>
|
||||
</code></pre>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
<div class="search-results">
|
||||
<div class="has-results">
|
||||
|
||||
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
|
||||
<ul class="search-results-list"></ul>
|
||||
|
||||
</div>
|
||||
<div class="no-results">
|
||||
|
||||
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<a href="./" class="navigation navigation-prev " aria-label="Previous page: Advanced">
|
||||
<i class="fa fa-angle-left"></i>
|
||||
</a>
|
||||
|
||||
|
||||
<a href="route_validation.html" class="navigation navigation-next " aria-label="Next page: Route Validation">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Route conflicts","level":"1.3.1","depth":2,"next":{"title":"Route Validation","level":"1.3.2","depth":2,"path":"advanced/route_validation.md","ref":"advanced/route_validation.md","articles":[]},"previous":{"title":"Advanced","level":"1.3","depth":1,"path":"advanced/README.md","ref":"advanced/README.md","articles":[{"title":"Route conflicts","level":"1.3.1","depth":2,"path":"advanced/route_conflicts.md","ref":"advanced/route_conflicts.md","articles":[]},{"title":"Route Validation","level":"1.3.2","depth":2,"path":"advanced/route_validation.md","ref":"advanced/route_validation.md","articles":[]},{"title":"Configuring routers","level":"1.3.3","depth":2,"path":"advanced/configuring_routers.md","ref":"advanced/configuring_routers.md","articles":[]}]},"dir":"ltr"},"config":{"plugins":["editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"github":{"url":"https://github.com/metosin/reitit"},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"advanced/route_conflicts.md","mtime":"2017-10-29T07:29:44.989Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2017-10-29T07:30:20.667Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook.js"></script>
|
||||
<script src="../gitbook/theme.js"></script>
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-editlink/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-github/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-search/search.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
@ -990,7 +990,7 @@
|
|||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Route Validation","level":"7.4","depth":1,"next":{"title":"Dev Workflow","level":"7.5","depth":1,"path":"advanced/dev_workflow.md","ref":"advanced/dev_workflow.md","articles":[]},"previous":{"title":"Different Routers","level":"7.3","depth":1,"path":"advanced/different_routers.md","ref":"advanced/different_routers.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"advanced/route_validation.md","mtime":"2020-01-14T13:47:50.967Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-24T11:08:28.724Z"},"basePath":"..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Route Validation","level":"7.4","depth":1,"next":{"title":"Dev Workflow","level":"7.5","depth":1,"path":"advanced/dev_workflow.md","ref":"advanced/dev_workflow.md","articles":[]},"previous":{"title":"Different Routers","level":"7.3","depth":1,"path":"advanced/different_routers.md","ref":"advanced/different_routers.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"advanced/route_validation.md","mtime":"2020-01-14T13:47:50.967Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-28T09:52:25.779Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -911,7 +911,7 @@
|
|||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Shared Routes","level":"7.6","depth":1,"next":{"title":"Performance","level":"8.1","depth":1,"path":"performance.md","ref":"performance.md","articles":[]},"previous":{"title":"Dev Workflow","level":"7.5","depth":1,"path":"advanced/dev_workflow.md","ref":"advanced/dev_workflow.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"advanced/shared_routes.md","mtime":"2020-01-14T13:47:50.967Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-24T11:08:28.724Z"},"basePath":"..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Shared Routes","level":"7.6","depth":1,"next":{"title":"Performance","level":"8.1","depth":1,"path":"performance.md","ref":"performance.md","articles":[]},"previous":{"title":"Dev Workflow","level":"7.5","depth":1,"path":"advanced/dev_workflow.md","ref":"advanced/dev_workflow.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"advanced/shared_routes.md","mtime":"2020-01-14T13:47:50.967Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-28T09:52:25.779Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
|
|
|||
682
basics.html
682
basics.html
|
|
@ -1,682 +0,0 @@
|
|||
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="" >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>Route syntax · GitBook</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="description" content="">
|
||||
<meta name="generator" content="GitBook 3.2.3">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="gitbook/style.css">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="gitbook/gitbook-plugin-highlight/website.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="gitbook/gitbook-plugin-search/search.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta name="HandheldFriendly" content="true"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
|
||||
<link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">
|
||||
|
||||
|
||||
<link rel="next" href="basics.html" />
|
||||
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="book">
|
||||
<div class="book-summary">
|
||||
|
||||
|
||||
<div id="book-search-input" role="search">
|
||||
<input type="text" placeholder="Type to search" />
|
||||
</div>
|
||||
|
||||
|
||||
<nav role="navigation">
|
||||
|
||||
|
||||
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1" data-path="./">
|
||||
|
||||
<a href="./">
|
||||
|
||||
|
||||
Introduction
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
Basics
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.2.1" data-path="basics.html">
|
||||
|
||||
<a href="basics.html#route-syntax">
|
||||
|
||||
|
||||
Route syntax
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.2" data-path="basics.html">
|
||||
|
||||
<a href="basics.html#router">
|
||||
|
||||
|
||||
Router
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.3" data-path="basics.html">
|
||||
|
||||
<a href="basics.html#path-based-routing">
|
||||
|
||||
|
||||
Path-based Routing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.4" data-path="basics.html">
|
||||
|
||||
<a href="basics.html#name-based-routing">
|
||||
|
||||
|
||||
Name-based Routing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.5" data-path="basics.html">
|
||||
|
||||
<a href="basics.html#route-data">
|
||||
|
||||
|
||||
Route data
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.6" data-path="basics.html">
|
||||
|
||||
<a href="basics.html#different-routers">
|
||||
|
||||
|
||||
Different Routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
Advanced
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.3.1" data-path="route_conflicts.html">
|
||||
|
||||
<a href="route_conflicts.html">
|
||||
|
||||
|
||||
Route conflicts
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.2" data-path="route_validation.html">
|
||||
|
||||
<a href="route_validation.html">
|
||||
|
||||
|
||||
Route Validation
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.3" data-path="configuring_routers.html">
|
||||
|
||||
<a href="configuring_routers.html">
|
||||
|
||||
|
||||
Configuring routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
Ring
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.4.1" data-path="ring.html">
|
||||
|
||||
<a href="ring.html">
|
||||
|
||||
|
||||
Ring-router
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.2" data-path="dynamic_extensions.html">
|
||||
|
||||
<a href="dynamic_extensions.html">
|
||||
|
||||
|
||||
Dynamic extensions
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.3" data-path="parameter_coercion.html">
|
||||
|
||||
<a href="parameter_coercion.html">
|
||||
|
||||
|
||||
Parameter coercion
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.4" data-path="compiling_middleware.html">
|
||||
|
||||
<a href="compiling_middleware.html">
|
||||
|
||||
|
||||
Compiling middleware
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
TODO: Swagger & OpenAPI
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.6" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
TODO: Interceptors
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
<li>
|
||||
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
|
||||
Published with GitBook
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="book-body">
|
||||
|
||||
<div class="body-inner">
|
||||
|
||||
|
||||
|
||||
<div class="book-header" role="navigation">
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
<i class="fa fa-circle-o-notch fa-spin"></i>
|
||||
<a href="." >Route syntax</a>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="page-wrapper" tabindex="-1" role="main">
|
||||
<div class="page-inner">
|
||||
|
||||
<div id="book-search-results">
|
||||
<div class="search-noresults">
|
||||
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<h1 id="route-syntax">Route Syntax</h1>
|
||||
<p>Raw routes are defined as vectors, which have a String path, optional (non-sequential) route argument and optional child routes. Routes can be wrapped in vectors and lists and <code>nil</code> routes are ignored. Paths can have path-parameters (<code>:id</code>) or catch-all-parameters (<code>*path</code>).</p>
|
||||
<p>Simple route:</p>
|
||||
<pre><code class="lang-clj">[<span class="hljs-string">"/ping"</span>]
|
||||
</code></pre>
|
||||
<p>Two routes:</p>
|
||||
<pre><code class="lang-clj">[[<span class="hljs-string">"/ping"</span>]
|
||||
[<span class="hljs-string">"/pong"</span>]]
|
||||
</code></pre>
|
||||
<p>Routes with route arguments:</p>
|
||||
<pre><code class="lang-clj">[[<span class="hljs-string">"/ping"</span> <span class="hljs-symbol">::ping</span>]
|
||||
[<span class="hljs-string">"/pong"</span> {<span class="hljs-symbol">:name</span> <span class="hljs-symbol">::pong</span>}]]
|
||||
</code></pre>
|
||||
<p>Routes with path parameters:</p>
|
||||
<pre><code class="lang-clj">[[<span class="hljs-string">"/users/:user-id"</span>]
|
||||
[<span class="hljs-string">"/api/:version/ping"</span>]]
|
||||
</code></pre>
|
||||
<p>Route with catch-all parameter:</p>
|
||||
<pre><code class="lang-clj">[<span class="hljs-string">"/public/*path"</span>]
|
||||
</code></pre>
|
||||
<p>Nested routes:</p>
|
||||
<pre><code class="lang-clj">[<span class="hljs-string">"/api"</span>
|
||||
[<span class="hljs-string">"/admin"</span> {<span class="hljs-symbol">:middleware</span> [<span class="hljs-symbol">::admin</span>]}
|
||||
[<span class="hljs-string">""</span> <span class="hljs-symbol">::admin</span>]
|
||||
[<span class="hljs-string">"/db"</span> <span class="hljs-symbol">::db</span>]]
|
||||
[<span class="hljs-string">"/ping"</span> <span class="hljs-symbol">::ping</span>]]
|
||||
</code></pre>
|
||||
<p>Same routes flattened:</p>
|
||||
<pre><code class="lang-clj">[[<span class="hljs-string">"/api/admin"</span> {<span class="hljs-symbol">:middleware</span> [<span class="hljs-symbol">::admin</span>], <span class="hljs-symbol">:name</span> <span class="hljs-symbol">::admin</span>}]
|
||||
[<span class="hljs-string">"/api/admin/db"</span> {<span class="hljs-symbol">:middleware</span> [<span class="hljs-symbol">::admin</span>], <span class="hljs-symbol">:name</span> <span class="hljs-symbol">::db</span>}]
|
||||
[<span class="hljs-string">"/api/ping"</span> {<span class="hljs-symbol">:name</span> <span class="hljs-symbol">::ping</span>}]]
|
||||
</code></pre>
|
||||
<p>As routes are just data, it's easy to create them programamtically:</p>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name"><span class="hljs-builtin-name">defn</span></span> cqrs-routes [actions dev-mode?]
|
||||
[<span class="hljs-string">"/api"</span> {<span class="hljs-symbol">:interceptors</span> [<span class="hljs-symbol">::api</span> <span class="hljs-symbol">::db</span>]}
|
||||
(<span class="hljs-name"><span class="hljs-builtin-name">for</span></span> [[type interceptor] actions
|
||||
<span class="hljs-symbol">:let</span> [path (<span class="hljs-name"><span class="hljs-builtin-name">str</span></span> <span class="hljs-string">"/"</span> (<span class="hljs-name"><span class="hljs-builtin-name">name</span></span> interceptor))
|
||||
method (<span class="hljs-name"><span class="hljs-builtin-name">condp</span></span> = type
|
||||
<span class="hljs-symbol">:query</span> <span class="hljs-symbol">:get</span>
|
||||
<span class="hljs-symbol">:command</span> <span class="hljs-symbol">:post</span>)]]
|
||||
[path {method {<span class="hljs-symbol">:interceptors</span> [interceptor]}}])
|
||||
(<span class="hljs-name"><span class="hljs-builtin-name">if</span></span> dev-mode? [<span class="hljs-string">"/dev-tools"</span> <span class="hljs-symbol">::dev-tools</span>])])
|
||||
</code></pre>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name">cqrs-routes</span>
|
||||
[[<span class="hljs-symbol">:query</span> 'get-user]
|
||||
[<span class="hljs-symbol">:command</span> 'add-user]
|
||||
[<span class="hljs-symbol">:command</span> 'add-order]]
|
||||
<span class="hljs-literal">false</span>)
|
||||
<span class="hljs-comment">; ["/api" {:interceptors [::api ::db]}</span>
|
||||
<span class="hljs-comment">; (["/get-user" {:get {:interceptors [get-user]}}]</span>
|
||||
<span class="hljs-comment">; ["/add-user" {:post {:interceptors [add-user]}}]</span>
|
||||
<span class="hljs-comment">; ["/add-order" {:post {:interceptors [add-order]}}])</span>
|
||||
<span class="hljs-comment">; nil]</span>
|
||||
</code></pre>
|
||||
<h1 id="router">Router</h1>
|
||||
<p>Routes are just data and to do actual routing, we need a Router satisfying the <code>reitit.core/Router</code> protocol. Routers are created with <code>reitit.core/router</code> function, taking the raw routes and optionally an options map. Raw routes gets expanded and optionally coerced and compiled.</p>
|
||||
<p><code>Router</code> protocol:</p>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name"><span class="hljs-builtin-name">defprotocol</span></span> Router
|
||||
(<span class="hljs-name">router-name</span> [this])
|
||||
(<span class="hljs-name">routes</span> [this])
|
||||
(<span class="hljs-name">options</span> [this])
|
||||
(<span class="hljs-name">route-names</span> [this])
|
||||
(<span class="hljs-name">match-by-path</span> [this path])
|
||||
(<span class="hljs-name">match-by-name</span> [this name] [this name params]))
|
||||
</code></pre>
|
||||
<p>Creating a router:</p>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name">require</span> '[reitit.core <span class="hljs-symbol">:as</span> r])
|
||||
|
||||
(<span class="hljs-name"><span class="hljs-builtin-name">def</span></span> router
|
||||
(<span class="hljs-name">r/router</span>
|
||||
[[<span class="hljs-string">"/api"</span>
|
||||
[<span class="hljs-string">"/ping"</span> <span class="hljs-symbol">::ping</span>]
|
||||
[<span class="hljs-string">"/user/:id"</span> <span class="hljs-symbol">::user</span>]]]))
|
||||
</code></pre>
|
||||
<p>Router flattens the raw routes and expands the route arguments using <code>reitit.core/Expand</code> protocol. By default, <code>Keyword</code>s are expanded to <code>:name</code> and functions are expaned to <code>:handler</code>. <code>nil</code> routes are removed. The expanded routes can be retrieved with router:</p>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name">r/routes</span> router)
|
||||
<span class="hljs-comment">; [["/api/ping" {:name :user/ping}]</span>
|
||||
<span class="hljs-comment">; ["/api/user/:id" {:name :user/user}]]</span>
|
||||
</code></pre>
|
||||
<h2 id="path-based-routing">Path-based routing</h2>
|
||||
<p>Path-based routing is done using the <code>reitit.core/match-by-path</code> function. It takes the router and path as arguments and returns one of the following:</p>
|
||||
<ul>
|
||||
<li><code>nil</code>, no match</li>
|
||||
<li><code>PartialMatch</code>, path matched, missing path-parameters (only in reverse-routing)</li>
|
||||
<li><code>Match</code>, exact match</li>
|
||||
</ul>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name">r/match-by-path</span> router <span class="hljs-string">"/hello"</span>)
|
||||
<span class="hljs-comment">; nil</span>
|
||||
</code></pre>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name">r/match-by-path</span> router <span class="hljs-string">"/api/user/1"</span>)
|
||||
<span class="hljs-comment">; #Match{:template "/api/user/:id"</span>
|
||||
<span class="hljs-comment">; :meta {:name :user/user}</span>
|
||||
<span class="hljs-comment">; :path "/api/user/1"</span>
|
||||
<span class="hljs-comment">; :result nil</span>
|
||||
<span class="hljs-comment">; :params {:id "1"}}</span>
|
||||
</code></pre>
|
||||
<h2 id="name-based-routing">Name-based routing</h2>
|
||||
<p>All routes which <code>:name</code> route data defined, can be matched by name.</p>
|
||||
<p>Listing all route names:</p>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name">r/route-names</span> router)
|
||||
<span class="hljs-comment">; [:user/ping :user/user]</span>
|
||||
</code></pre>
|
||||
<p>Matching by name:</p>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name">r/match-by-name</span> router <span class="hljs-symbol">::user</span>)
|
||||
<span class="hljs-comment">; #PartialMatch{:template "/api/user/:id",</span>
|
||||
<span class="hljs-comment">; :meta {:name :user/user},</span>
|
||||
<span class="hljs-comment">; :result nil,</span>
|
||||
<span class="hljs-comment">; :params nil,</span>
|
||||
<span class="hljs-comment">; :required #{:id}}</span>
|
||||
|
||||
(<span class="hljs-name">r/partial-match?</span> (<span class="hljs-name">r/match-by-name</span> router <span class="hljs-symbol">::user</span>))
|
||||
<span class="hljs-comment">; true</span>
|
||||
</code></pre>
|
||||
<p>We only got a partial match as we didn't provide the needed path-parameters. Let's provide the them too:</p>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name">r/match-by-name</span> router <span class="hljs-symbol">::user</span> {<span class="hljs-symbol">:id</span> <span class="hljs-string">"1"</span>})
|
||||
<span class="hljs-comment">; #Match{:template "/api/user/:id"</span>
|
||||
<span class="hljs-comment">; :meta {:name :user/user}</span>
|
||||
<span class="hljs-comment">; :path "/api/user/1"</span>
|
||||
<span class="hljs-comment">; :result nil</span>
|
||||
<span class="hljs-comment">; :params {:id "1"}}</span>
|
||||
</code></pre>
|
||||
<p>There is also a exception throwing version:</p>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name">r/match-by-name!</span> router <span class="hljs-symbol">::user</span>)
|
||||
<span class="hljs-comment">; ExceptionInfo missing path-params for route /api/user/:id: #{:id}</span>
|
||||
</code></pre>
|
||||
<h1 id="route-data">Route data</h1>
|
||||
<p>Routes can have arbitrary meta-data, interpreted by the router (via it's <code>:compile</code> hook) or the application itself. For nested routes, route data is accumulated recursively using <a href="https://github.com/weavejester/meta-merge" target="_blank">meta-merge</a>. By default, it appends collections, but it can be overridden to do <code>:prepend</code>, <code>:replace</code> or <code>:displace</code>.</p>
|
||||
<p>An example router with nested data:</p>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name"><span class="hljs-builtin-name">def</span></span> router
|
||||
(<span class="hljs-name">r/router</span>
|
||||
[<span class="hljs-string">"/api"</span> {<span class="hljs-symbol">:interceptors</span> [<span class="hljs-symbol">::api</span>]}
|
||||
[<span class="hljs-string">"/ping"</span> <span class="hljs-symbol">::ping</span>]
|
||||
[<span class="hljs-string">"/admin"</span> {<span class="hljs-symbol">:roles</span> #{<span class="hljs-symbol">:admin</span>}}
|
||||
[<span class="hljs-string">"/users"</span> <span class="hljs-symbol">::users</span>]
|
||||
[<span class="hljs-string">"/db"</span> {<span class="hljs-symbol">:interceptors</span> [<span class="hljs-symbol">::db</span>]
|
||||
<span class="hljs-symbol">:roles</span> ^<span class="hljs-symbol">:replace</span> #{<span class="hljs-symbol">:db-admin</span>}}
|
||||
[<span class="hljs-string">"/:db"</span> {<span class="hljs-symbol">:parameters</span> {<span class="hljs-symbol">:db</span> String}}
|
||||
[<span class="hljs-string">"/drop"</span> <span class="hljs-symbol">::drop-db</span>]
|
||||
[<span class="hljs-string">"/stats"</span> <span class="hljs-symbol">::db-stats</span>]]]]]))
|
||||
</code></pre>
|
||||
<p>Resolved route tree:</p>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name">reitit/routes</span> router)
|
||||
<span class="hljs-comment">; [["/api/ping" {:interceptors [::api]</span>
|
||||
<span class="hljs-comment">; :name ::ping}]</span>
|
||||
<span class="hljs-comment">; ["/api/admin/users" {:interceptors [::api]</span>
|
||||
<span class="hljs-comment">; :roles #{:admin}</span>
|
||||
<span class="hljs-comment">; :name ::users}]</span>
|
||||
<span class="hljs-comment">; ["/api/admin/db/:db/drop" {:interceptors [::api ::db]</span>
|
||||
<span class="hljs-comment">; :roles #{:db-admin}</span>
|
||||
<span class="hljs-comment">; :parameters {:db String}</span>
|
||||
<span class="hljs-comment">; :name ::drop-db}]</span>
|
||||
<span class="hljs-comment">; ["/api/admin/db/:db/stats" {:interceptors [::api ::db]</span>
|
||||
<span class="hljs-comment">; :roles #{:db-admin}</span>
|
||||
<span class="hljs-comment">; :parameters {:db String}</span>
|
||||
<span class="hljs-comment">; :name ::db-stats}]]</span>
|
||||
</code></pre>
|
||||
<p>Route data is returned with <code>Match</code> and the application can act based on it.</p>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name">r/match-by-path</span> router <span class="hljs-string">"/api/admin/db/users/drop"</span>)
|
||||
<span class="hljs-comment">; #Match{:template "/api/admin/db/:db/drop"</span>
|
||||
<span class="hljs-comment">; :meta {:interceptors [::api ::db]</span>
|
||||
<span class="hljs-comment">; :roles #{:db-admin}</span>
|
||||
<span class="hljs-comment">; :parameters {:db String}</span>
|
||||
<span class="hljs-comment">; :name ::drop-db}</span>
|
||||
<span class="hljs-comment">; :result nil</span>
|
||||
<span class="hljs-comment">; :params {:db "users"}</span>
|
||||
<span class="hljs-comment">; :path "/api/admin/db/users/drop"}</span>
|
||||
</code></pre>
|
||||
<h1 id="different-routers">Different Routers</h1>
|
||||
<p>Reitit ships with several different implementations for the <code>Router</code> protocol, originally based on the awesome <a href="https://github.com/pedestal/pedestal/tree/master/route" target="_blank">Pedestal</a> implementation. <code>router</code> selects the most suitable implementation by inspecting the expanded routes. The implementation can be set manually using <code>:router</code> ROUTER OPTION.</p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>router</th>
|
||||
<th>description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><code>:linear-router</code></td>
|
||||
<td>Matches the routes one-by-one starting from the top until a match is found. Works with any kind of routes.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>:lookup-router</code></td>
|
||||
<td>Fastest router, uses hash-lookup to resolve the route. Valid if no paths have path or catch-all parameters.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>:mixed-router</code></td>
|
||||
<td>Creates internally a <code>:linear-router</code> and a <code>:lookup-router</code> and used them to effectively get best-of-both-worlds. Valid if there are no CONFLICTING ROUTES.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>:prefix-tree-router</code></td>
|
||||
<td><a href="https://github.com/julienschmidt/httprouter#how-does-it-work" target="_blank">TODO</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>The router name can be asked from the router</p>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name">r/router-name</span> router)
|
||||
<span class="hljs-comment">; :mixed-router</span>
|
||||
</code></pre>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
<div class="search-results">
|
||||
<div class="has-results">
|
||||
|
||||
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
|
||||
<ul class="search-results-list"></ul>
|
||||
|
||||
</div>
|
||||
<div class="no-results">
|
||||
|
||||
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<a href="basics.html#router" class="navigation navigation-next navigation-unique" aria-label="Next page: Router">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Route syntax","level":"1.2.1","depth":2,"next":{"title":"Router","level":"1.2.2","depth":2,"anchor":"#router","path":"basics.md","ref":"basics.md#router","articles":[]},"previous":{"title":"Basics","level":"1.2","depth":1,"ref":"","articles":[{"title":"Route syntax","level":"1.2.1","depth":2,"anchor":"#route-syntax","path":"basics.md","ref":"basics.md#route-syntax","articles":[]},{"title":"Router","level":"1.2.2","depth":2,"anchor":"#router","path":"basics.md","ref":"basics.md#router","articles":[]},{"title":"Path-based Routing","level":"1.2.3","depth":2,"anchor":"#path-based-routing","path":"basics.md","ref":"basics.md#path-based-routing","articles":[]},{"title":"Name-based Routing","level":"1.2.4","depth":2,"anchor":"#name-based-routing","path":"basics.md","ref":"basics.md#name-based-routing","articles":[]},{"title":"Route data","level":"1.2.5","depth":2,"anchor":"#route-data","path":"basics.md","ref":"basics.md#route-data","articles":[]},{"title":"Different Routers","level":"1.2.6","depth":2,"anchor":"#different-routers","path":"basics.md","ref":"basics.md#different-routers","articles":[]}]},"dir":"ltr"},"config":{"plugins":["editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"github":{"url":"https://github.com/metosin/reitit"},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"basics.md","mtime":"2017-10-25T15:00:22.836Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2017-10-25T15:01:14.084Z"},"basePath":".","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
|
||||
<script src="gitbook/gitbook.js"></script>
|
||||
<script src="gitbook/theme.js"></script>
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-editlink/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-github/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-search/search-engine.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-search/search.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-sharing/buttons.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
@ -1,521 +0,0 @@
|
|||
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="" >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>Different Routers · GitBook</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="description" content="">
|
||||
<meta name="generator" content="GitBook 3.2.3">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/style.css">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta name="HandheldFriendly" content="true"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
|
||||
<link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
|
||||
|
||||
|
||||
<link rel="next" href="../advanced/" />
|
||||
|
||||
|
||||
<link rel="prev" href="route_data.html" />
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="book">
|
||||
<div class="book-summary">
|
||||
|
||||
|
||||
<div id="book-search-input" role="search">
|
||||
<input type="text" placeholder="Type to search" />
|
||||
</div>
|
||||
|
||||
|
||||
<nav role="navigation">
|
||||
|
||||
|
||||
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1" data-path="../">
|
||||
|
||||
<a href="../">
|
||||
|
||||
|
||||
Introduction
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2" data-path="./">
|
||||
|
||||
<a href="./">
|
||||
|
||||
|
||||
Basics
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.2.1" data-path="route_syntax.html">
|
||||
|
||||
<a href="route_syntax.html">
|
||||
|
||||
|
||||
Route syntax
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.2" data-path="router.html">
|
||||
|
||||
<a href="router.html">
|
||||
|
||||
|
||||
Router
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.3" data-path="path_based_routing.html">
|
||||
|
||||
<a href="path_based_routing.html">
|
||||
|
||||
|
||||
Path-based Routing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.4" data-path="name_based_routing.html">
|
||||
|
||||
<a href="name_based_routing.html">
|
||||
|
||||
|
||||
Name-based Routing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.5" data-path="route_data.html">
|
||||
|
||||
<a href="route_data.html">
|
||||
|
||||
|
||||
Route data
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter active" data-level="1.2.6" data-path="different_routers.html">
|
||||
|
||||
<a href="different_routers.html">
|
||||
|
||||
|
||||
Different Routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3" data-path="../advanced/">
|
||||
|
||||
<a href="../advanced/">
|
||||
|
||||
|
||||
Advanced
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.3.1" data-path="../advanced/route_conflicts.html">
|
||||
|
||||
<a href="../advanced/route_conflicts.html">
|
||||
|
||||
|
||||
Route conflicts
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.2" data-path="../advanced/route_validation.html">
|
||||
|
||||
<a href="../advanced/route_validation.html">
|
||||
|
||||
|
||||
Route Validation
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.3" data-path="../advanced/configuring_routers.html">
|
||||
|
||||
<a href="../advanced/configuring_routers.html">
|
||||
|
||||
|
||||
Configuring routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4" data-path="../ring/">
|
||||
|
||||
<a href="../ring/">
|
||||
|
||||
|
||||
Ring
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.4.1" data-path="../ring/ring.html">
|
||||
|
||||
<a href="../ring/ring.html">
|
||||
|
||||
|
||||
Ring-router
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.2" data-path="../ring/dynamic_extensions.html">
|
||||
|
||||
<a href="../ring/dynamic_extensions.html">
|
||||
|
||||
|
||||
Dynamic extensions
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.3" data-path="../ring/parameter_coercion.html">
|
||||
|
||||
<a href="../ring/parameter_coercion.html">
|
||||
|
||||
|
||||
Parameter coercion
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.4" data-path="../ring/compiling_middleware.html">
|
||||
|
||||
<a href="../ring/compiling_middleware.html">
|
||||
|
||||
|
||||
Compiling middleware
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
TODO: Swagger & OpenAPI
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.6" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
TODO: Interceptors
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
<li>
|
||||
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
|
||||
Published with GitBook
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="book-body">
|
||||
|
||||
<div class="body-inner">
|
||||
|
||||
|
||||
|
||||
<div class="book-header" role="navigation">
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
<i class="fa fa-circle-o-notch fa-spin"></i>
|
||||
<a href=".." >Different Routers</a>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="page-wrapper" tabindex="-1" role="main">
|
||||
<div class="page-inner">
|
||||
|
||||
<div id="book-search-results">
|
||||
<div class="search-noresults">
|
||||
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<h1 id="different-routers">Different Routers</h1>
|
||||
<p>Reitit ships with several different implementations for the <code>Router</code> protocol, originally based on the awesome <a href="https://github.com/pedestal/pedestal/tree/master/route" target="_blank">Pedestal</a> implementation. <code>router</code> selects the most suitable implementation by inspecting the expanded routes. The implementation can be set manually using <code>:router</code> ROUTER OPTION.</p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>router</th>
|
||||
<th>description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><code>:linear-router</code></td>
|
||||
<td>Matches the routes one-by-one starting from the top until a match is found. Works with any kind of routes.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>:lookup-router</code></td>
|
||||
<td>Fastest router, uses hash-lookup to resolve the route. Valid if no paths have path or catch-all parameters.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>:mixed-router</code></td>
|
||||
<td>Creates internally a <code>:linear-router</code> and a <code>:lookup-router</code> and used them to effectively get best-of-both-worlds. Valid if there are no CONFLICTING ROUTES.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>:prefix-tree-router</code></td>
|
||||
<td><a href="https://github.com/julienschmidt/httprouter#how-does-it-work" target="_blank">TODO</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>The router name can be asked from the router</p>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name">r/router-name</span> router)
|
||||
<span class="hljs-comment">; :mixed-router</span>
|
||||
</code></pre>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
<div class="search-results">
|
||||
<div class="has-results">
|
||||
|
||||
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
|
||||
<ul class="search-results-list"></ul>
|
||||
|
||||
</div>
|
||||
<div class="no-results">
|
||||
|
||||
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<a href="route_data.html" class="navigation navigation-prev " aria-label="Previous page: Route data">
|
||||
<i class="fa fa-angle-left"></i>
|
||||
</a>
|
||||
|
||||
|
||||
<a href="../advanced/" class="navigation navigation-next " aria-label="Next page: Advanced">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Different Routers","level":"1.2.6","depth":2,"next":{"title":"Advanced","level":"1.3","depth":1,"path":"advanced/README.md","ref":"advanced/README.md","articles":[{"title":"Route conflicts","level":"1.3.1","depth":2,"path":"advanced/route_conflicts.md","ref":"advanced/route_conflicts.md","articles":[]},{"title":"Route Validation","level":"1.3.2","depth":2,"path":"advanced/route_validation.md","ref":"advanced/route_validation.md","articles":[]},{"title":"Configuring routers","level":"1.3.3","depth":2,"path":"advanced/configuring_routers.md","ref":"advanced/configuring_routers.md","articles":[]}]},"previous":{"title":"Route data","level":"1.2.5","depth":2,"path":"basics/route_data.md","ref":"basics/route_data.md","articles":[]},"dir":"ltr"},"config":{"plugins":["editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"github":{"url":"https://github.com/metosin/reitit"},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"basics/different_routers.md","mtime":"2017-10-29T07:29:44.989Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2017-10-29T07:30:20.667Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook.js"></script>
|
||||
<script src="../gitbook/theme.js"></script>
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-editlink/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-github/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-search/search.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
@ -878,7 +878,7 @@
|
|||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Error Messages","level":"2.8","depth":1,"next":{"title":"Coercion Explained","level":"3.1","depth":1,"path":"coercion/coercion.md","ref":"coercion/coercion.md","articles":[]},"previous":{"title":"Route Conflicts","level":"2.7","depth":1,"path":"basics/route_conflicts.md","ref":"basics/route_conflicts.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"basics/error_messages.md","mtime":"2020-07-24T09:34:09.873Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-24T11:08:28.724Z"},"basePath":"..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Error Messages","level":"2.8","depth":1,"next":{"title":"Coercion Explained","level":"3.1","depth":1,"path":"coercion/coercion.md","ref":"coercion/coercion.md","articles":[]},"previous":{"title":"Route Conflicts","level":"2.7","depth":1,"path":"basics/route_conflicts.md","ref":"basics/route_conflicts.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"basics/error_messages.md","mtime":"2020-07-24T09:34:09.873Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-28T09:52:25.779Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,842 +0,0 @@
|
|||
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="" >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>Basics · GitBook</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="description" content="">
|
||||
<meta name="generator" content="GitBook 3.2.3">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/style.css">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta name="HandheldFriendly" content="true"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
|
||||
<link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
|
||||
|
||||
|
||||
<link rel="next" href="route_syntax.html" />
|
||||
|
||||
|
||||
<link rel="prev" href="../" />
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="book">
|
||||
<div class="book-summary">
|
||||
|
||||
|
||||
<div id="book-search-input" role="search">
|
||||
<input type="text" placeholder="Type to search" />
|
||||
</div>
|
||||
|
||||
|
||||
<nav role="navigation">
|
||||
|
||||
|
||||
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1" data-path="../">
|
||||
|
||||
<a href="../">
|
||||
|
||||
|
||||
Introduction
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter active" data-level="1.2" data-path="./">
|
||||
|
||||
<a href="./">
|
||||
|
||||
|
||||
Basics
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.2.1" data-path="route_syntax.html">
|
||||
|
||||
<a href="route_syntax.html">
|
||||
|
||||
|
||||
Route Syntax
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.2" data-path="router.html">
|
||||
|
||||
<a href="router.html">
|
||||
|
||||
|
||||
Router
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.3" data-path="path_based_routing.html">
|
||||
|
||||
<a href="path_based_routing.html">
|
||||
|
||||
|
||||
Path-based Routing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.4" data-path="name_based_routing.html">
|
||||
|
||||
<a href="name_based_routing.html">
|
||||
|
||||
|
||||
Name-based Routing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.5" data-path="route_data.html">
|
||||
|
||||
<a href="route_data.html">
|
||||
|
||||
|
||||
Route Data
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.6" data-path="route_data_validation.html">
|
||||
|
||||
<a href="route_data_validation.html">
|
||||
|
||||
|
||||
Route Data Validation
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.7" data-path="route_conflicts.html">
|
||||
|
||||
<a href="route_conflicts.html">
|
||||
|
||||
|
||||
Route Conflicts
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3" data-path="../coercion/">
|
||||
|
||||
<a href="../coercion/">
|
||||
|
||||
|
||||
Coercion
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.3.1" data-path="../coercion/coercion.html">
|
||||
|
||||
<a href="../coercion/coercion.html">
|
||||
|
||||
|
||||
Coercion Explained
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.2" data-path="../coercion/schema_coercion.html">
|
||||
|
||||
<a href="../coercion/schema_coercion.html">
|
||||
|
||||
|
||||
Plumatic Schema
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.3" data-path="../coercion/clojure_spec_coercion.html">
|
||||
|
||||
<a href="../coercion/clojure_spec_coercion.html">
|
||||
|
||||
|
||||
Clojure.spec
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.4" data-path="../coercion/data_spec_coercion.html">
|
||||
|
||||
<a href="../coercion/data_spec_coercion.html">
|
||||
|
||||
|
||||
Data-specs
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4" data-path="../ring/">
|
||||
|
||||
<a href="../ring/">
|
||||
|
||||
|
||||
Ring
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.4.1" data-path="../ring/ring.html">
|
||||
|
||||
<a href="../ring/ring.html">
|
||||
|
||||
|
||||
Ring-router
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.2" data-path="../ring/reverse_routing.html">
|
||||
|
||||
<a href="../ring/reverse_routing.html">
|
||||
|
||||
|
||||
Reverse-routing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.3" data-path="../ring/default_handler.html">
|
||||
|
||||
<a href="../ring/default_handler.html">
|
||||
|
||||
|
||||
Default handler
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.4" data-path="../ring/static.html">
|
||||
|
||||
<a href="../ring/static.html">
|
||||
|
||||
|
||||
Static Resources
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.5" data-path="../ring/dynamic_extensions.html">
|
||||
|
||||
<a href="../ring/dynamic_extensions.html">
|
||||
|
||||
|
||||
Dynamic Extensions
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.6" data-path="../ring/data_driven_middleware.html">
|
||||
|
||||
<a href="../ring/data_driven_middleware.html">
|
||||
|
||||
|
||||
Data-driven Middleware
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.7" data-path="../ring/transforming_middleware_chain.html">
|
||||
|
||||
<a href="../ring/transforming_middleware_chain.html">
|
||||
|
||||
|
||||
Transforming Middleware Chain
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.8" data-path="../ring/middleware_registry.html">
|
||||
|
||||
<a href="../ring/middleware_registry.html">
|
||||
|
||||
|
||||
Middleware Registry
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.9" data-path="../ring/default_middleware.html">
|
||||
|
||||
<a href="../ring/default_middleware.html">
|
||||
|
||||
|
||||
Default Middleware
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.10" data-path="../ring/coercion.html">
|
||||
|
||||
<a href="../ring/coercion.html">
|
||||
|
||||
|
||||
Pluggable Coercion
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.11" data-path="../ring/route_data_validation.html">
|
||||
|
||||
<a href="../ring/route_data_validation.html">
|
||||
|
||||
|
||||
Route Data Validation
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.12" data-path="../ring/compiling_middleware.html">
|
||||
|
||||
<a href="../ring/compiling_middleware.html">
|
||||
|
||||
|
||||
Compiling Middleware
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.13" data-path="../ring/swagger.html">
|
||||
|
||||
<a href="../ring/swagger.html">
|
||||
|
||||
|
||||
Swagger Support
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5" data-path="../advanced/">
|
||||
|
||||
<a href="../advanced/">
|
||||
|
||||
|
||||
Advanced
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.5.1" data-path="../advanced/configuring_routers.html">
|
||||
|
||||
<a href="../advanced/configuring_routers.html">
|
||||
|
||||
|
||||
Configuring Routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.2" data-path="../advanced/composing_routers.html">
|
||||
|
||||
<a href="../advanced/composing_routers.html">
|
||||
|
||||
|
||||
Composing Routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.3" data-path="../advanced/different_routers.html">
|
||||
|
||||
<a href="../advanced/different_routers.html">
|
||||
|
||||
|
||||
Different Routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.4" data-path="../advanced/route_validation.html">
|
||||
|
||||
<a href="../advanced/route_validation.html">
|
||||
|
||||
|
||||
Route Validation
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.5" data-path="../advanced/dev_workflow.html">
|
||||
|
||||
<a href="../advanced/dev_workflow.html">
|
||||
|
||||
|
||||
Dev Workflow
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.6" data-path="../patterns/">
|
||||
|
||||
<a href="../patterns/">
|
||||
|
||||
|
||||
Patterns
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.6.1" data-path="../patterns/shared_routes.html">
|
||||
|
||||
<a href="../patterns/shared_routes.html">
|
||||
|
||||
|
||||
Shared Routes
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.7" data-path="../frontend/">
|
||||
|
||||
<a href="../frontend/">
|
||||
|
||||
|
||||
Frontend
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.7.1" data-path="../frontend/basics.html">
|
||||
|
||||
<a href="../frontend/basics.html">
|
||||
|
||||
|
||||
Basics
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.7.2" data-path="../frontend/browser.html">
|
||||
|
||||
<a href="../frontend/browser.html">
|
||||
|
||||
|
||||
Browser integration
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.7.3" data-path="../frontend/controllers.html">
|
||||
|
||||
<a href="../frontend/controllers.html">
|
||||
|
||||
|
||||
Controllers (WIP)
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.8" data-path="../performance.html">
|
||||
|
||||
<a href="../performance.html">
|
||||
|
||||
|
||||
Performance
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.9" data-path="../interceptors.html">
|
||||
|
||||
<a href="../interceptors.html">
|
||||
|
||||
|
||||
Interceptors (WIP)
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.10" data-path="../development.html">
|
||||
|
||||
<a href="../development.html">
|
||||
|
||||
|
||||
Development Instructions
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.11" data-path="../faq.html">
|
||||
|
||||
<a href="../faq.html">
|
||||
|
||||
|
||||
FAQ
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
<li>
|
||||
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
|
||||
Published with GitBook
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="book-body">
|
||||
|
||||
<div class="body-inner">
|
||||
|
||||
|
||||
|
||||
<div class="book-header" role="navigation">
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
<i class="fa fa-circle-o-notch fa-spin"></i>
|
||||
<a href=".." >Basics</a>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="page-wrapper" tabindex="-1" role="main">
|
||||
<div class="page-inner">
|
||||
|
||||
<div id="book-search-results">
|
||||
<div class="search-noresults">
|
||||
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<h1 id="basics">Basics</h1>
|
||||
<ul>
|
||||
<li><a href="route_syntax.html">Route Syntax</a></li>
|
||||
<li><a href="router.html">Router</a></li>
|
||||
<li><a href="path_based_routing.html">Path-based Routing</a></li>
|
||||
<li><a href="name_based_routing.html">Name-based Routing</a></li>
|
||||
<li><a href="route_data.html">Route Data</a></li>
|
||||
<li><a href="route_data_validation.html">Route Data Validation</a></li>
|
||||
<li><a href="route_conflicts.html">Route Conflicts</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
<div class="search-results">
|
||||
<div class="has-results">
|
||||
|
||||
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
|
||||
<ul class="search-results-list"></ul>
|
||||
|
||||
</div>
|
||||
<div class="no-results">
|
||||
|
||||
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<a href="../" class="navigation navigation-prev " aria-label="Previous page: Introduction">
|
||||
<i class="fa fa-angle-left"></i>
|
||||
</a>
|
||||
|
||||
|
||||
<a href="route_syntax.html" class="navigation navigation-next " aria-label="Next page: Route Syntax">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Basics","level":"1.2","depth":1,"next":{"title":"Route Syntax","level":"1.2.1","depth":2,"path":"basics/route_syntax.md","ref":"basics/route_syntax.md","articles":[]},"previous":{"title":"Introduction","level":"1.1","depth":1,"path":"README.md","ref":"README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"github":{"url":"https://github.com/metosin/reitit"},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"basics/README.md","mtime":"2018-09-02T14:52:37.217Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-02T14:53:17.801Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook.js"></script>
|
||||
<script src="../gitbook/theme.js"></script>
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-editlink/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-github/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-search/search.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
@ -913,7 +913,7 @@
|
|||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Name-based Routing","level":"2.4","depth":1,"next":{"title":"Route Data","level":"2.5","depth":1,"path":"basics/route_data.md","ref":"basics/route_data.md","articles":[]},"previous":{"title":"Path-based Routing","level":"2.3","depth":1,"path":"basics/path_based_routing.md","ref":"basics/path_based_routing.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"basics/name_based_routing.md","mtime":"2020-01-14T13:47:50.969Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-24T11:08:28.724Z"},"basePath":"..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Name-based Routing","level":"2.4","depth":1,"next":{"title":"Route Data","level":"2.5","depth":1,"path":"basics/route_data.md","ref":"basics/route_data.md","articles":[]},"previous":{"title":"Path-based Routing","level":"2.3","depth":1,"path":"basics/path_based_routing.md","ref":"basics/path_based_routing.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"basics/name_based_routing.md","mtime":"2020-01-14T13:47:50.969Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-28T09:52:25.779Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -871,7 +871,7 @@
|
|||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Path-based Routing","level":"2.3","depth":1,"next":{"title":"Name-based Routing","level":"2.4","depth":1,"path":"basics/name_based_routing.md","ref":"basics/name_based_routing.md","articles":[]},"previous":{"title":"Router","level":"2.2","depth":1,"path":"basics/router.md","ref":"basics/router.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"basics/path_based_routing.md","mtime":"2020-01-14T13:47:50.970Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-24T11:08:28.724Z"},"basePath":"..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Path-based Routing","level":"2.3","depth":1,"next":{"title":"Name-based Routing","level":"2.4","depth":1,"path":"basics/name_based_routing.md","ref":"basics/name_based_routing.md","articles":[]},"previous":{"title":"Router","level":"2.2","depth":1,"path":"basics/router.md","ref":"basics/router.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"basics/path_based_routing.md","mtime":"2020-01-14T13:47:50.970Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-28T09:52:25.779Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -927,7 +927,7 @@
|
|||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Route Conflicts","level":"2.7","depth":1,"next":{"title":"Error Messages","level":"2.8","depth":1,"path":"basics/error_messages.md","ref":"basics/error_messages.md","articles":[]},"previous":{"title":"Route Data Validation","level":"2.6","depth":1,"path":"basics/route_data_validation.md","ref":"basics/route_data_validation.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"basics/route_conflicts.md","mtime":"2020-01-14T13:47:50.971Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-24T11:08:28.724Z"},"basePath":"..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Route Conflicts","level":"2.7","depth":1,"next":{"title":"Error Messages","level":"2.8","depth":1,"path":"basics/error_messages.md","ref":"basics/error_messages.md","articles":[]},"previous":{"title":"Route Data Validation","level":"2.6","depth":1,"path":"basics/route_data_validation.md","ref":"basics/route_data_validation.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"basics/route_conflicts.md","mtime":"2020-01-14T13:47:50.971Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-28T09:52:25.779Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -965,7 +965,7 @@
|
|||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Route Data","level":"2.5","depth":1,"next":{"title":"Route Data Validation","level":"2.6","depth":1,"path":"basics/route_data_validation.md","ref":"basics/route_data_validation.md","articles":[]},"previous":{"title":"Name-based Routing","level":"2.4","depth":1,"path":"basics/name_based_routing.md","ref":"basics/name_based_routing.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"basics/route_data.md","mtime":"2020-01-14T13:47:50.972Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-24T11:08:28.724Z"},"basePath":"..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Route Data","level":"2.5","depth":1,"next":{"title":"Route Data Validation","level":"2.6","depth":1,"path":"basics/route_data_validation.md","ref":"basics/route_data_validation.md","articles":[]},"previous":{"title":"Name-based Routing","level":"2.4","depth":1,"path":"basics/name_based_routing.md","ref":"basics/name_based_routing.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"basics/route_data.md","mtime":"2020-01-14T13:47:50.972Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-28T09:52:25.779Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -942,7 +942,7 @@
|
|||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Route Data Validation","level":"2.6","depth":1,"next":{"title":"Route Conflicts","level":"2.7","depth":1,"path":"basics/route_conflicts.md","ref":"basics/route_conflicts.md","articles":[]},"previous":{"title":"Route Data","level":"2.5","depth":1,"path":"basics/route_data.md","ref":"basics/route_data.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"basics/route_data_validation.md","mtime":"2020-01-14T13:47:50.973Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-24T11:08:28.724Z"},"basePath":"..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Route Data Validation","level":"2.6","depth":1,"next":{"title":"Route Conflicts","level":"2.7","depth":1,"path":"basics/route_conflicts.md","ref":"basics/route_conflicts.md","articles":[]},"previous":{"title":"Route Data","level":"2.5","depth":1,"path":"basics/route_data.md","ref":"basics/route_data.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"basics/route_data_validation.md","mtime":"2020-01-14T13:47:50.973Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-28T09:52:25.779Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -949,7 +949,7 @@
|
|||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Route Syntax","level":"2.1","depth":1,"next":{"title":"Router","level":"2.2","depth":1,"path":"basics/router.md","ref":"basics/router.md","articles":[]},"previous":{"title":"Introduction","level":"1.1","depth":1,"path":"README.md","ref":"README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"basics/route_syntax.md","mtime":"2020-04-01T08:59:17.505Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-24T11:08:28.724Z"},"basePath":"..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Route Syntax","level":"2.1","depth":1,"next":{"title":"Router","level":"2.2","depth":1,"path":"basics/router.md","ref":"basics/router.md","articles":[]},"previous":{"title":"Introduction","level":"1.1","depth":1,"path":"README.md","ref":"README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"basics/route_syntax.md","mtime":"2020-04-01T08:59:17.505Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-28T09:52:25.779Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -925,7 +925,7 @@
|
|||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Router","level":"2.2","depth":1,"next":{"title":"Path-based Routing","level":"2.3","depth":1,"path":"basics/path_based_routing.md","ref":"basics/path_based_routing.md","articles":[]},"previous":{"title":"Route Syntax","level":"2.1","depth":1,"path":"basics/route_syntax.md","ref":"basics/route_syntax.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"basics/router.md","mtime":"2020-05-22T13:12:18.030Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-24T11:08:28.724Z"},"basePath":"..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Router","level":"2.2","depth":1,"next":{"title":"Path-based Routing","level":"2.3","depth":1,"path":"basics/path_based_routing.md","ref":"basics/path_based_routing.md","articles":[]},"previous":{"title":"Route Syntax","level":"2.1","depth":1,"path":"basics/route_syntax.md","ref":"basics/route_syntax.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"basics/router.md","mtime":"2020-05-22T13:12:18.030Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-28T09:52:25.779Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -990,7 +990,7 @@ The <code>s/keys</code> accepts <code>:opt-un</code> to support optional keys.</
|
|||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Clojure.spec","level":"3.3","depth":1,"next":{"title":"Data-specs","level":"3.4","depth":1,"path":"coercion/data_spec_coercion.md","ref":"coercion/data_spec_coercion.md","articles":[]},"previous":{"title":"Plumatic Schema","level":"3.2","depth":1,"path":"coercion/schema_coercion.md","ref":"coercion/schema_coercion.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"coercion/clojure_spec_coercion.md","mtime":"2020-05-22T13:12:18.030Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-24T11:08:28.724Z"},"basePath":"..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Clojure.spec","level":"3.3","depth":1,"next":{"title":"Data-specs","level":"3.4","depth":1,"path":"coercion/data_spec_coercion.md","ref":"coercion/data_spec_coercion.md","articles":[]},"previous":{"title":"Plumatic Schema","level":"3.2","depth":1,"path":"coercion/schema_coercion.md","ref":"coercion/schema_coercion.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"coercion/clojure_spec_coercion.md","mtime":"2020-05-22T13:12:18.030Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-28T09:52:25.779Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -979,7 +979,7 @@
|
|||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Coercion Explained","level":"3.1","depth":1,"next":{"title":"Plumatic Schema","level":"3.2","depth":1,"path":"coercion/schema_coercion.md","ref":"coercion/schema_coercion.md","articles":[]},"previous":{"title":"Error Messages","level":"2.8","depth":1,"path":"basics/error_messages.md","ref":"basics/error_messages.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"coercion/coercion.md","mtime":"2020-05-22T13:12:18.031Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-24T11:08:28.724Z"},"basePath":"..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Coercion Explained","level":"3.1","depth":1,"next":{"title":"Plumatic Schema","level":"3.2","depth":1,"path":"coercion/schema_coercion.md","ref":"coercion/schema_coercion.md","articles":[]},"previous":{"title":"Error Messages","level":"2.8","depth":1,"path":"basics/error_messages.md","ref":"basics/error_messages.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"coercion/coercion.md","mtime":"2020-05-22T13:12:18.031Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-28T09:52:25.779Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -877,7 +877,7 @@
|
|||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Data-specs","level":"3.4","depth":1,"next":{"title":"Ring-router","level":"4.1","depth":1,"path":"ring/ring.md","ref":"ring/ring.md","articles":[]},"previous":{"title":"Clojure.spec","level":"3.3","depth":1,"path":"coercion/clojure_spec_coercion.md","ref":"coercion/clojure_spec_coercion.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"coercion/data_spec_coercion.md","mtime":"2020-01-14T13:47:50.976Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-24T11:08:28.724Z"},"basePath":"..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Data-specs","level":"3.4","depth":1,"next":{"title":"Ring-router","level":"4.1","depth":1,"path":"ring/ring.md","ref":"ring/ring.md","articles":[]},"previous":{"title":"Clojure.spec","level":"3.3","depth":1,"path":"coercion/clojure_spec_coercion.md","ref":"coercion/clojure_spec_coercion.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"coercion/data_spec_coercion.md","mtime":"2020-01-14T13:47:50.976Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-28T09:52:25.779Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,839 +0,0 @@
|
|||
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="" >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>Coercion · GitBook</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="description" content="">
|
||||
<meta name="generator" content="GitBook 3.2.3">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/style.css">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta name="HandheldFriendly" content="true"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
|
||||
<link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
|
||||
|
||||
|
||||
<link rel="next" href="coercion.html" />
|
||||
|
||||
|
||||
<link rel="prev" href="../basics/route_conflicts.html" />
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="book">
|
||||
<div class="book-summary">
|
||||
|
||||
|
||||
<div id="book-search-input" role="search">
|
||||
<input type="text" placeholder="Type to search" />
|
||||
</div>
|
||||
|
||||
|
||||
<nav role="navigation">
|
||||
|
||||
|
||||
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1" data-path="../">
|
||||
|
||||
<a href="../">
|
||||
|
||||
|
||||
Introduction
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2" data-path="../basics/">
|
||||
|
||||
<a href="../basics/">
|
||||
|
||||
|
||||
Basics
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.2.1" data-path="../basics/route_syntax.html">
|
||||
|
||||
<a href="../basics/route_syntax.html">
|
||||
|
||||
|
||||
Route Syntax
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.2" data-path="../basics/router.html">
|
||||
|
||||
<a href="../basics/router.html">
|
||||
|
||||
|
||||
Router
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.3" data-path="../basics/path_based_routing.html">
|
||||
|
||||
<a href="../basics/path_based_routing.html">
|
||||
|
||||
|
||||
Path-based Routing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.4" data-path="../basics/name_based_routing.html">
|
||||
|
||||
<a href="../basics/name_based_routing.html">
|
||||
|
||||
|
||||
Name-based Routing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.5" data-path="../basics/route_data.html">
|
||||
|
||||
<a href="../basics/route_data.html">
|
||||
|
||||
|
||||
Route Data
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.6" data-path="../basics/route_data_validation.html">
|
||||
|
||||
<a href="../basics/route_data_validation.html">
|
||||
|
||||
|
||||
Route Data Validation
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.7" data-path="../basics/route_conflicts.html">
|
||||
|
||||
<a href="../basics/route_conflicts.html">
|
||||
|
||||
|
||||
Route Conflicts
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter active" data-level="1.3" data-path="./">
|
||||
|
||||
<a href="./">
|
||||
|
||||
|
||||
Coercion
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.3.1" data-path="coercion.html">
|
||||
|
||||
<a href="coercion.html">
|
||||
|
||||
|
||||
Coercion Explained
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.2" data-path="schema_coercion.html">
|
||||
|
||||
<a href="schema_coercion.html">
|
||||
|
||||
|
||||
Plumatic Schema
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.3" data-path="clojure_spec_coercion.html">
|
||||
|
||||
<a href="clojure_spec_coercion.html">
|
||||
|
||||
|
||||
Clojure.spec
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.4" data-path="data_spec_coercion.html">
|
||||
|
||||
<a href="data_spec_coercion.html">
|
||||
|
||||
|
||||
Data-specs
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4" data-path="../ring/">
|
||||
|
||||
<a href="../ring/">
|
||||
|
||||
|
||||
Ring
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.4.1" data-path="../ring/ring.html">
|
||||
|
||||
<a href="../ring/ring.html">
|
||||
|
||||
|
||||
Ring-router
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.2" data-path="../ring/reverse_routing.html">
|
||||
|
||||
<a href="../ring/reverse_routing.html">
|
||||
|
||||
|
||||
Reverse-routing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.3" data-path="../ring/default_handler.html">
|
||||
|
||||
<a href="../ring/default_handler.html">
|
||||
|
||||
|
||||
Default handler
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.4" data-path="../ring/static.html">
|
||||
|
||||
<a href="../ring/static.html">
|
||||
|
||||
|
||||
Static Resources
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.5" data-path="../ring/dynamic_extensions.html">
|
||||
|
||||
<a href="../ring/dynamic_extensions.html">
|
||||
|
||||
|
||||
Dynamic Extensions
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.6" data-path="../ring/data_driven_middleware.html">
|
||||
|
||||
<a href="../ring/data_driven_middleware.html">
|
||||
|
||||
|
||||
Data-driven Middleware
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.7" data-path="../ring/transforming_middleware_chain.html">
|
||||
|
||||
<a href="../ring/transforming_middleware_chain.html">
|
||||
|
||||
|
||||
Transforming Middleware Chain
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.8" data-path="../ring/middleware_registry.html">
|
||||
|
||||
<a href="../ring/middleware_registry.html">
|
||||
|
||||
|
||||
Middleware Registry
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.9" data-path="../ring/default_middleware.html">
|
||||
|
||||
<a href="../ring/default_middleware.html">
|
||||
|
||||
|
||||
Default Middleware
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.10" data-path="../ring/coercion.html">
|
||||
|
||||
<a href="../ring/coercion.html">
|
||||
|
||||
|
||||
Pluggable Coercion
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.11" data-path="../ring/route_data_validation.html">
|
||||
|
||||
<a href="../ring/route_data_validation.html">
|
||||
|
||||
|
||||
Route Data Validation
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.12" data-path="../ring/compiling_middleware.html">
|
||||
|
||||
<a href="../ring/compiling_middleware.html">
|
||||
|
||||
|
||||
Compiling Middleware
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.13" data-path="../ring/swagger.html">
|
||||
|
||||
<a href="../ring/swagger.html">
|
||||
|
||||
|
||||
Swagger Support
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5" data-path="../advanced/">
|
||||
|
||||
<a href="../advanced/">
|
||||
|
||||
|
||||
Advanced
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.5.1" data-path="../advanced/configuring_routers.html">
|
||||
|
||||
<a href="../advanced/configuring_routers.html">
|
||||
|
||||
|
||||
Configuring Routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.2" data-path="../advanced/composing_routers.html">
|
||||
|
||||
<a href="../advanced/composing_routers.html">
|
||||
|
||||
|
||||
Composing Routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.3" data-path="../advanced/different_routers.html">
|
||||
|
||||
<a href="../advanced/different_routers.html">
|
||||
|
||||
|
||||
Different Routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.4" data-path="../advanced/route_validation.html">
|
||||
|
||||
<a href="../advanced/route_validation.html">
|
||||
|
||||
|
||||
Route Validation
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.5" data-path="../advanced/dev_workflow.html">
|
||||
|
||||
<a href="../advanced/dev_workflow.html">
|
||||
|
||||
|
||||
Dev Workflow
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.6" data-path="../patterns/">
|
||||
|
||||
<a href="../patterns/">
|
||||
|
||||
|
||||
Patterns
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.6.1" data-path="../patterns/shared_routes.html">
|
||||
|
||||
<a href="../patterns/shared_routes.html">
|
||||
|
||||
|
||||
Shared Routes
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.7" data-path="../frontend/">
|
||||
|
||||
<a href="../frontend/">
|
||||
|
||||
|
||||
Frontend
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.7.1" data-path="../frontend/basics.html">
|
||||
|
||||
<a href="../frontend/basics.html">
|
||||
|
||||
|
||||
Basics
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.7.2" data-path="../frontend/browser.html">
|
||||
|
||||
<a href="../frontend/browser.html">
|
||||
|
||||
|
||||
Browser integration
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.7.3" data-path="../frontend/controllers.html">
|
||||
|
||||
<a href="../frontend/controllers.html">
|
||||
|
||||
|
||||
Controllers (WIP)
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.8" data-path="../performance.html">
|
||||
|
||||
<a href="../performance.html">
|
||||
|
||||
|
||||
Performance
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.9" data-path="../interceptors.html">
|
||||
|
||||
<a href="../interceptors.html">
|
||||
|
||||
|
||||
Interceptors (WIP)
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.10" data-path="../development.html">
|
||||
|
||||
<a href="../development.html">
|
||||
|
||||
|
||||
Development Instructions
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.11" data-path="../faq.html">
|
||||
|
||||
<a href="../faq.html">
|
||||
|
||||
|
||||
FAQ
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
<li>
|
||||
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
|
||||
Published with GitBook
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="book-body">
|
||||
|
||||
<div class="body-inner">
|
||||
|
||||
|
||||
|
||||
<div class="book-header" role="navigation">
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
<i class="fa fa-circle-o-notch fa-spin"></i>
|
||||
<a href=".." >Coercion</a>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="page-wrapper" tabindex="-1" role="main">
|
||||
<div class="page-inner">
|
||||
|
||||
<div id="book-search-results">
|
||||
<div class="search-noresults">
|
||||
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<h1 id="coercion">Coercion</h1>
|
||||
<ul>
|
||||
<li><a href="coercion.html">Coercion Explained</a></li>
|
||||
<li><a href="schema_coercion.html">Plumatic Schema</a></li>
|
||||
<li><a href="clojure_spec_coercion.html">Clojure.spec</a></li>
|
||||
<li><a href="data_spec_coercion.html">Data-specs</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
<div class="search-results">
|
||||
<div class="has-results">
|
||||
|
||||
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
|
||||
<ul class="search-results-list"></ul>
|
||||
|
||||
</div>
|
||||
<div class="no-results">
|
||||
|
||||
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<a href="../basics/route_conflicts.html" class="navigation navigation-prev " aria-label="Previous page: Route Conflicts">
|
||||
<i class="fa fa-angle-left"></i>
|
||||
</a>
|
||||
|
||||
|
||||
<a href="coercion.html" class="navigation navigation-next " aria-label="Next page: Coercion Explained">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Coercion","level":"1.3","depth":1,"next":{"title":"Coercion Explained","level":"1.3.1","depth":2,"path":"coercion/coercion.md","ref":"coercion/coercion.md","articles":[]},"previous":{"title":"Route Conflicts","level":"1.2.7","depth":2,"path":"basics/route_conflicts.md","ref":"basics/route_conflicts.md","articles":[]},"dir":"ltr"},"config":{"plugins":["editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"github":{"url":"https://github.com/metosin/reitit"},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"coercion/README.md","mtime":"2018-09-02T14:52:37.221Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-02T14:53:17.801Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook.js"></script>
|
||||
<script src="../gitbook/theme.js"></script>
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-editlink/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-github/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-search/search.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
@ -878,7 +878,7 @@
|
|||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Plumatic Schema","level":"3.2","depth":1,"next":{"title":"Clojure.spec","level":"3.3","depth":1,"path":"coercion/clojure_spec_coercion.md","ref":"coercion/clojure_spec_coercion.md","articles":[]},"previous":{"title":"Coercion Explained","level":"3.1","depth":1,"path":"coercion/coercion.md","ref":"coercion/coercion.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"coercion/schema_coercion.md","mtime":"2020-01-14T13:47:50.978Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-24T11:08:28.724Z"},"basePath":"..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Plumatic Schema","level":"3.2","depth":1,"next":{"title":"Clojure.spec","level":"3.3","depth":1,"path":"coercion/clojure_spec_coercion.md","ref":"coercion/clojure_spec_coercion.md","articles":[]},"previous":{"title":"Coercion Explained","level":"3.1","depth":1,"path":"coercion/coercion.md","ref":"coercion/coercion.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"coercion/schema_coercion.md","mtime":"2020-01-14T13:47:50.978Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-28T09:52:25.779Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,546 +0,0 @@
|
|||
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="" >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>Compiling middleware · GitBook</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="description" content="">
|
||||
<meta name="generator" content="GitBook 3.2.3">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="gitbook/style.css">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="gitbook/gitbook-plugin-highlight/website.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="gitbook/gitbook-plugin-search/search.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta name="HandheldFriendly" content="true"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
|
||||
<link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">
|
||||
|
||||
|
||||
|
||||
<link rel="prev" href="parameter_coercion.html" />
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="book">
|
||||
<div class="book-summary">
|
||||
|
||||
|
||||
<div id="book-search-input" role="search">
|
||||
<input type="text" placeholder="Type to search" />
|
||||
</div>
|
||||
|
||||
|
||||
<nav role="navigation">
|
||||
|
||||
|
||||
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1" data-path="./">
|
||||
|
||||
<a href="./">
|
||||
|
||||
|
||||
Introduction
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
Basics
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.2.1" data-path="basics.html">
|
||||
|
||||
<a href="basics.html#route-syntax">
|
||||
|
||||
|
||||
Route syntax
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.2" data-path="basics.html">
|
||||
|
||||
<a href="basics.html#router">
|
||||
|
||||
|
||||
Router
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.3" data-path="basics.html">
|
||||
|
||||
<a href="basics.html#path-based-routing">
|
||||
|
||||
|
||||
Path-based Routing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.4" data-path="basics.html">
|
||||
|
||||
<a href="basics.html#name-based-routing">
|
||||
|
||||
|
||||
Name-based Routing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.5" data-path="basics.html">
|
||||
|
||||
<a href="basics.html#route-data">
|
||||
|
||||
|
||||
Route data
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.6" data-path="basics.html">
|
||||
|
||||
<a href="basics.html#different-routers">
|
||||
|
||||
|
||||
Different Routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
Advanced
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.3.1" data-path="route_conflicts.html">
|
||||
|
||||
<a href="route_conflicts.html">
|
||||
|
||||
|
||||
Route conflicts
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.2" data-path="route_validation.html">
|
||||
|
||||
<a href="route_validation.html">
|
||||
|
||||
|
||||
Route Validation
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.3" data-path="configuring_routers.html">
|
||||
|
||||
<a href="configuring_routers.html">
|
||||
|
||||
|
||||
Configuring routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
Ring
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.4.1" data-path="ring.html">
|
||||
|
||||
<a href="ring.html">
|
||||
|
||||
|
||||
Ring-router
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.2" data-path="dynamic_extensions.html">
|
||||
|
||||
<a href="dynamic_extensions.html">
|
||||
|
||||
|
||||
Dynamic extensions
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.3" data-path="parameter_coercion.html">
|
||||
|
||||
<a href="parameter_coercion.html">
|
||||
|
||||
|
||||
Parameter coercion
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter active" data-level="1.4.4" data-path="compiling_middleware.html">
|
||||
|
||||
<a href="compiling_middleware.html">
|
||||
|
||||
|
||||
Compiling middleware
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
TODO: Swagger & OpenAPI
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.6" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
TODO: Interceptors
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
<li>
|
||||
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
|
||||
Published with GitBook
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="book-body">
|
||||
|
||||
<div class="body-inner">
|
||||
|
||||
|
||||
|
||||
<div class="book-header" role="navigation">
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
<i class="fa fa-circle-o-notch fa-spin"></i>
|
||||
<a href="." >Compiling middleware</a>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="page-wrapper" tabindex="-1" role="main">
|
||||
<div class="page-inner">
|
||||
|
||||
<div id="book-search-results">
|
||||
<div class="search-noresults">
|
||||
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<h1 id="compiling-middleware">Compiling Middleware</h1>
|
||||
<p>The <a href="ring.html#meta-data-based-extensions">meta-data extensions</a> are a easy way to extend the system. Routes meta-data can be transformed into any shape (records, functions etc.) in route compilation, enabling fast access at request-time.</p>
|
||||
<p>Still, we can do better. As we know the exact route that interceptor/middleware is linked to, we can pass the (compiled) route information into the interceptor/middleware at creation-time. It can extract and transform relevant data just for it and pass it into the actual request-handler via a closure - yielding faster runtime processing.</p>
|
||||
<p>To do this we use <a href="ring.html#middleware-records">middleware records</a> <code>:gen</code> hook instead of the normal <code>:wrap</code>. <code>:gen</code> expects a function of <code>route-meta router-opts => wrap</code>. Middleware can also return <code>nil</code>, which effective unmounts the middleware. Why mount a <code>wrap-enforce-roles</code> middleware for a route if there are no roles required for it?</p>
|
||||
<p>To demonstrate the two approaches, below are response coercion middleware written as normal ring middleware function and as middleware record with <code>:gen</code>. These are the actual codes are from <a href="https://github.com/metosin/reitit/blob/master/src/reitit/coercion.cljc" target="_blank"><code>reitit.coercion</code></a>:</p>
|
||||
<h2 id="naive">Naive</h2>
|
||||
<ul>
|
||||
<li>Extracts the compiled route information on every request.</li>
|
||||
</ul>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name"><span class="hljs-builtin-name">defn</span></span> wrap-coerce-response
|
||||
<span class="hljs-string">"Pluggable response coercion middleware.
|
||||
Expects a :coercion of type `reitit.coercion.protocol/Coercion`
|
||||
and :responses from route meta, otherwise does not mount."</span>
|
||||
[handler]
|
||||
(<span class="hljs-name"><span class="hljs-builtin-name">fn</span></span>
|
||||
([request]
|
||||
(<span class="hljs-name"><span class="hljs-builtin-name">let</span></span> [response (<span class="hljs-name">handler</span> request)
|
||||
method (<span class="hljs-symbol">:request-method</span> request)
|
||||
match (<span class="hljs-name">ring/get-match</span> request)
|
||||
responses (<span class="hljs-name"><span class="hljs-builtin-name">-></span></span> match <span class="hljs-symbol">:result</span> method <span class="hljs-symbol">:meta</span> <span class="hljs-symbol">:responses</span>)
|
||||
coercion (<span class="hljs-name"><span class="hljs-builtin-name">-></span></span> match <span class="hljs-symbol">:meta</span> <span class="hljs-symbol">:coercion</span>)
|
||||
opts (<span class="hljs-name"><span class="hljs-builtin-name">-></span></span> match <span class="hljs-symbol">:meta</span> <span class="hljs-symbol">:opts</span>)]
|
||||
(<span class="hljs-name"><span class="hljs-builtin-name">if</span></span> (<span class="hljs-name"><span class="hljs-builtin-name">and</span></span> coercion responses)
|
||||
(<span class="hljs-name"><span class="hljs-builtin-name">let</span></span> [coercers (<span class="hljs-name">response-coercers</span> coercion responses opts)
|
||||
coerced (<span class="hljs-name">coerce-response</span> coercers request response)]
|
||||
(<span class="hljs-name">coerce-response</span> coercers request (<span class="hljs-name">handler</span> request)))
|
||||
(<span class="hljs-name">handler</span> request))))
|
||||
([request respond raise]
|
||||
(<span class="hljs-name"><span class="hljs-builtin-name">let</span></span> [response (<span class="hljs-name">handler</span> request)
|
||||
method (<span class="hljs-symbol">:request-method</span> request)
|
||||
match (<span class="hljs-name">ring/get-match</span> request)
|
||||
responses (<span class="hljs-name"><span class="hljs-builtin-name">-></span></span> match <span class="hljs-symbol">:result</span> method <span class="hljs-symbol">:meta</span> <span class="hljs-symbol">:responses</span>)
|
||||
coercion (<span class="hljs-name"><span class="hljs-builtin-name">-></span></span> match <span class="hljs-symbol">:meta</span> <span class="hljs-symbol">:coercion</span>)
|
||||
opts (<span class="hljs-name"><span class="hljs-builtin-name">-></span></span> match <span class="hljs-symbol">:meta</span> <span class="hljs-symbol">:opts</span>)]
|
||||
(<span class="hljs-name"><span class="hljs-builtin-name">if</span></span> (<span class="hljs-name"><span class="hljs-builtin-name">and</span></span> coercion responses)
|
||||
(<span class="hljs-name"><span class="hljs-builtin-name">let</span></span> [coercers (<span class="hljs-name">response-coercers</span> coercion responses opts)
|
||||
coerced (<span class="hljs-name">coerce-response</span> coercers request response)]
|
||||
(<span class="hljs-name">handler</span> request #(<span class="hljs-name">respond</span> (<span class="hljs-name">coerce-response</span> coercers request %))))
|
||||
(<span class="hljs-name">handler</span> request respond raise))))))
|
||||
</code></pre>
|
||||
<h2 id="compiled">Compiled</h2>
|
||||
<ul>
|
||||
<li>Route information is provided via a closure</li>
|
||||
<li>Pre-compiled coercers</li>
|
||||
<li>Mounts only if <code>:coercion</code> and <code>:responses</code> are defined for the route</li>
|
||||
</ul>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name"><span class="hljs-builtin-name">def</span></span> gen-wrap-coerce-response
|
||||
<span class="hljs-string">"Generator for pluggable response coercion middleware.
|
||||
Expects a :coercion of type `reitit.coercion.protocol/Coercion`
|
||||
and :responses from route meta, otherwise does not mount."</span>
|
||||
(<span class="hljs-name">middleware/create</span>
|
||||
{<span class="hljs-symbol">:name</span> <span class="hljs-symbol">::coerce-response</span>
|
||||
<span class="hljs-symbol">:gen</span> (<span class="hljs-name"><span class="hljs-builtin-name">fn</span></span> [{<span class="hljs-symbol">:keys</span> [responses coercion opts]} _]
|
||||
(<span class="hljs-name"><span class="hljs-builtin-name">if</span></span> (<span class="hljs-name"><span class="hljs-builtin-name">and</span></span> coercion responses)
|
||||
(<span class="hljs-name"><span class="hljs-builtin-name">let</span></span> [coercers (<span class="hljs-name">response-coercers</span> coercion responses opts)]
|
||||
(<span class="hljs-name"><span class="hljs-builtin-name">fn</span></span> [handler]
|
||||
(<span class="hljs-name"><span class="hljs-builtin-name">fn</span></span>
|
||||
([request]
|
||||
(<span class="hljs-name">coerce-response</span> coercers request (<span class="hljs-name">handler</span> request)))
|
||||
([request respond raise]
|
||||
(<span class="hljs-name">handler</span> request #(<span class="hljs-name">respond</span> (<span class="hljs-name">coerce-response</span> coercers request %)) raise)))))))}))
|
||||
</code></pre>
|
||||
<p>The <code>:gen</code> -version has 50% less code, is easier to reason about and is 2-4x faster on basic perf tests.</p>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
<div class="search-results">
|
||||
<div class="has-results">
|
||||
|
||||
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
|
||||
<ul class="search-results-list"></ul>
|
||||
|
||||
</div>
|
||||
<div class="no-results">
|
||||
|
||||
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<a href="parameter_coercion.html" class="navigation navigation-prev navigation-unique" aria-label="Previous page: Parameter coercion">
|
||||
<i class="fa fa-angle-left"></i>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Compiling middleware","level":"1.4.4","depth":2,"next":{"title":"TODO: Swagger & OpenAPI","level":"1.5","depth":1,"ref":"","articles":[]},"previous":{"title":"Parameter coercion","level":"1.4.3","depth":2,"path":"parameter_coercion.md","ref":"parameter_coercion.md","articles":[]},"dir":"ltr"},"config":{"plugins":["editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"github":{"url":"https://github.com/metosin/reitit"},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"compiling_middleware.md","mtime":"2017-10-25T15:00:22.836Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2017-10-25T15:01:14.084Z"},"basePath":".","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
|
||||
<script src="gitbook/gitbook.js"></script>
|
||||
<script src="gitbook/theme.js"></script>
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-editlink/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-github/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-search/search-engine.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-search/search.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-sharing/buttons.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
@ -1,527 +0,0 @@
|
|||
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="" >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>Configuring routers · GitBook</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="description" content="">
|
||||
<meta name="generator" content="GitBook 3.2.3">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="gitbook/style.css">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="gitbook/gitbook-plugin-highlight/website.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="gitbook/gitbook-plugin-search/search.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta name="HandheldFriendly" content="true"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
|
||||
<link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">
|
||||
|
||||
|
||||
|
||||
<link rel="prev" href="route_validation.html" />
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="book">
|
||||
<div class="book-summary">
|
||||
|
||||
|
||||
<div id="book-search-input" role="search">
|
||||
<input type="text" placeholder="Type to search" />
|
||||
</div>
|
||||
|
||||
|
||||
<nav role="navigation">
|
||||
|
||||
|
||||
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1" data-path="./">
|
||||
|
||||
<a href="./">
|
||||
|
||||
|
||||
Introduction
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
Basics
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.2.1" data-path="basics.html">
|
||||
|
||||
<a href="basics.html#route-syntax">
|
||||
|
||||
|
||||
Route syntax
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.2" data-path="basics.html">
|
||||
|
||||
<a href="basics.html#router">
|
||||
|
||||
|
||||
Router
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.3" data-path="basics.html">
|
||||
|
||||
<a href="basics.html#path-based-routing">
|
||||
|
||||
|
||||
Path-based Routing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.4" data-path="basics.html">
|
||||
|
||||
<a href="basics.html#name-based-routing">
|
||||
|
||||
|
||||
Name-based Routing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.5" data-path="basics.html">
|
||||
|
||||
<a href="basics.html#route-data">
|
||||
|
||||
|
||||
Route data
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.6" data-path="basics.html">
|
||||
|
||||
<a href="basics.html#different-routers">
|
||||
|
||||
|
||||
Different Routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
Advanced
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.3.1" data-path="route_conflicts.html">
|
||||
|
||||
<a href="route_conflicts.html">
|
||||
|
||||
|
||||
Route conflicts
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.2" data-path="route_validation.html">
|
||||
|
||||
<a href="route_validation.html">
|
||||
|
||||
|
||||
Route Validation
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter active" data-level="1.3.3" data-path="configuring_routers.html">
|
||||
|
||||
<a href="configuring_routers.html">
|
||||
|
||||
|
||||
Configuring routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
Ring
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.4.1" data-path="ring.html">
|
||||
|
||||
<a href="ring.html">
|
||||
|
||||
|
||||
Ring-router
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.2" data-path="dynamic_extensions.html">
|
||||
|
||||
<a href="dynamic_extensions.html">
|
||||
|
||||
|
||||
Dynamic extensions
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.3" data-path="parameter_coercion.html">
|
||||
|
||||
<a href="parameter_coercion.html">
|
||||
|
||||
|
||||
Parameter coercion
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.4" data-path="compiling_middleware.html">
|
||||
|
||||
<a href="compiling_middleware.html">
|
||||
|
||||
|
||||
Compiling middleware
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
TODO: Swagger & OpenAPI
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.6" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
TODO: Interceptors
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
<li>
|
||||
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
|
||||
Published with GitBook
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="book-body">
|
||||
|
||||
<div class="body-inner">
|
||||
|
||||
|
||||
|
||||
<div class="book-header" role="navigation">
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
<i class="fa fa-circle-o-notch fa-spin"></i>
|
||||
<a href="." >Configuring routers</a>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="page-wrapper" tabindex="-1" role="main">
|
||||
<div class="page-inner">
|
||||
|
||||
<div id="book-search-results">
|
||||
<div class="search-noresults">
|
||||
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<h2 id="configuring-routers">Configuring Routers</h2>
|
||||
<p>Routers can be configured via options. Options allow things like <a href="https://clojure.org/about/spec" target="_blank"><code>clojure.spec</code></a> validation for meta-data and fast, compiled handlers. The following options are available for the <code>reitit.core/router</code>:</p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>key</th>
|
||||
<th>description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><code>:path</code></td>
|
||||
<td>Base-path for routes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>:routes</code></td>
|
||||
<td>Initial resolved routes (default <code>[]</code>)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>:meta</code></td>
|
||||
<td>Initial expanded route-meta vector (default <code>[]</code>)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>:expand</code></td>
|
||||
<td>Function of <code>arg opts => meta</code> to expand route arg to route meta-data (default <code>reitit.core/expand</code>)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>:coerce</code></td>
|
||||
<td>Function of <code>route opts => route</code> to coerce resolved route, can throw or return <code>nil</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>:compile</code></td>
|
||||
<td>Function of <code>route opts => result</code> to compile a route handler</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>:conflicts</code></td>
|
||||
<td>Function of <code>{route #{route}} => side-effect</code> to handle conflicting routes (default <code>reitit.core/throw-on-conflicts!</code>)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>:router</code></td>
|
||||
<td>Function of <code>routes opts => router</code> to override the actual router implementation</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
<div class="search-results">
|
||||
<div class="has-results">
|
||||
|
||||
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
|
||||
<ul class="search-results-list"></ul>
|
||||
|
||||
</div>
|
||||
<div class="no-results">
|
||||
|
||||
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<a href="route_validation.html" class="navigation navigation-prev navigation-unique" aria-label="Previous page: Route Validation">
|
||||
<i class="fa fa-angle-left"></i>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Configuring routers","level":"1.3.3","depth":2,"next":{"title":"Ring","level":"1.4","depth":1,"ref":"","articles":[{"title":"Ring-router","level":"1.4.1","depth":2,"path":"ring.md","ref":"ring.md","articles":[]},{"title":"Dynamic extensions","level":"1.4.2","depth":2,"path":"dynamic_extensions.md","ref":"dynamic_extensions.md","articles":[]},{"title":"Parameter coercion","level":"1.4.3","depth":2,"path":"parameter_coercion.md","ref":"parameter_coercion.md","articles":[]},{"title":"Compiling middleware","level":"1.4.4","depth":2,"path":"compiling_middleware.md","ref":"compiling_middleware.md","articles":[]}]},"previous":{"title":"Route Validation","level":"1.3.2","depth":2,"path":"route_validation.md","ref":"route_validation.md","articles":[]},"dir":"ltr"},"config":{"plugins":["editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"github":{"url":"https://github.com/metosin/reitit"},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"configuring_routers.md","mtime":"2017-10-25T15:00:22.836Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2017-10-25T15:01:14.084Z"},"basePath":".","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
|
||||
<script src="gitbook/gitbook.js"></script>
|
||||
<script src="gitbook/theme.js"></script>
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-editlink/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-github/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-search/search-engine.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-search/search.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-sharing/buttons.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
@ -869,7 +869,7 @@ lein <span class="hljs-built_in">test</span>
|
|||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Development Instructions","level":"8.2","depth":1,"next":{"title":"FAQ","level":"8.3","depth":1,"path":"faq.md","ref":"faq.md","articles":[]},"previous":{"title":"Performance","level":"8.1","depth":1,"path":"performance.md","ref":"performance.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"development.md","mtime":"2020-01-14T13:47:50.978Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-24T11:08:28.724Z"},"basePath":".","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Development Instructions","level":"8.2","depth":1,"next":{"title":"FAQ","level":"8.3","depth":1,"path":"faq.md","ref":"faq.md","articles":[]},"previous":{"title":"Performance","level":"8.1","depth":1,"path":"performance.md","ref":"performance.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"development.md","mtime":"2020-01-14T13:47:50.978Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-28T09:52:25.779Z"},"basePath":".","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,525 +0,0 @@
|
|||
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="" >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>Dynamic extensions · GitBook</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="description" content="">
|
||||
<meta name="generator" content="GitBook 3.2.3">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="gitbook/style.css">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="gitbook/gitbook-plugin-highlight/website.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="gitbook/gitbook-plugin-search/search.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta name="HandheldFriendly" content="true"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
|
||||
<link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">
|
||||
|
||||
|
||||
<link rel="next" href="parameter_coercion.html" />
|
||||
|
||||
|
||||
<link rel="prev" href="ring.html" />
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="book">
|
||||
<div class="book-summary">
|
||||
|
||||
|
||||
<div id="book-search-input" role="search">
|
||||
<input type="text" placeholder="Type to search" />
|
||||
</div>
|
||||
|
||||
|
||||
<nav role="navigation">
|
||||
|
||||
|
||||
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1" data-path="./">
|
||||
|
||||
<a href="./">
|
||||
|
||||
|
||||
Introduction
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
Basics
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.2.1" data-path="basics.html">
|
||||
|
||||
<a href="basics.html#route-syntax">
|
||||
|
||||
|
||||
Route syntax
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.2" data-path="basics.html">
|
||||
|
||||
<a href="basics.html#router">
|
||||
|
||||
|
||||
Router
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.3" data-path="basics.html">
|
||||
|
||||
<a href="basics.html#path-based-routing">
|
||||
|
||||
|
||||
Path-based Routing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.4" data-path="basics.html">
|
||||
|
||||
<a href="basics.html#name-based-routing">
|
||||
|
||||
|
||||
Name-based Routing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.5" data-path="basics.html">
|
||||
|
||||
<a href="basics.html#route-data">
|
||||
|
||||
|
||||
Route data
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.6" data-path="basics.html">
|
||||
|
||||
<a href="basics.html#different-routers">
|
||||
|
||||
|
||||
Different Routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
Advanced
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.3.1" data-path="route_conflicts.html">
|
||||
|
||||
<a href="route_conflicts.html">
|
||||
|
||||
|
||||
Route conflicts
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.2" data-path="route_validation.html">
|
||||
|
||||
<a href="route_validation.html">
|
||||
|
||||
|
||||
Route Validation
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.3" data-path="configuring_routers.html">
|
||||
|
||||
<a href="configuring_routers.html">
|
||||
|
||||
|
||||
Configuring routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
Ring
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.4.1" data-path="ring.html">
|
||||
|
||||
<a href="ring.html">
|
||||
|
||||
|
||||
Ring-router
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter active" data-level="1.4.2" data-path="dynamic_extensions.html">
|
||||
|
||||
<a href="dynamic_extensions.html">
|
||||
|
||||
|
||||
Dynamic extensions
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.3" data-path="parameter_coercion.html">
|
||||
|
||||
<a href="parameter_coercion.html">
|
||||
|
||||
|
||||
Parameter coercion
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.4" data-path="compiling_middleware.html">
|
||||
|
||||
<a href="compiling_middleware.html">
|
||||
|
||||
|
||||
Compiling middleware
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
TODO: Swagger & OpenAPI
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.6" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
TODO: Interceptors
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
<li>
|
||||
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
|
||||
Published with GitBook
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="book-body">
|
||||
|
||||
<div class="body-inner">
|
||||
|
||||
|
||||
|
||||
<div class="book-header" role="navigation">
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
<i class="fa fa-circle-o-notch fa-spin"></i>
|
||||
<a href="." >Dynamic extensions</a>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="page-wrapper" tabindex="-1" role="main">
|
||||
<div class="page-inner">
|
||||
|
||||
<div id="book-search-results">
|
||||
<div class="search-noresults">
|
||||
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<h1 id="dynamic-extensions">Dynamic extensions</h1>
|
||||
<p><code>ring-handler</code> injects the <code>Match</code> into a request and it can be extracted at runtime with <code>reitit.ring/get-match</code>. This can be used to build dynamic extensions to the system.</p>
|
||||
<p>Example middleware to guard routes based on user roles:</p>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name">require</span> '[clojure.set <span class="hljs-symbol">:as</span> set])
|
||||
|
||||
(<span class="hljs-name"><span class="hljs-builtin-name">defn</span></span> wrap-enforce-roles [handler]
|
||||
(<span class="hljs-name"><span class="hljs-builtin-name">fn</span></span> [{<span class="hljs-symbol">:keys</span> [<span class="hljs-symbol">::roles</span>] <span class="hljs-symbol">:as</span> request}]
|
||||
(<span class="hljs-name"><span class="hljs-builtin-name">let</span></span> [required (<span class="hljs-name">some-></span> request (<span class="hljs-name">ring/get-match</span>) <span class="hljs-symbol">:meta</span> <span class="hljs-symbol">::roles</span>)]
|
||||
(<span class="hljs-name"><span class="hljs-builtin-name">if</span></span> (<span class="hljs-name"><span class="hljs-builtin-name">and</span></span> (<span class="hljs-name"><span class="hljs-builtin-name">seq</span></span> required) (<span class="hljs-name"><span class="hljs-builtin-name">not</span></span> (<span class="hljs-name">set/intersection</span> required roles)))
|
||||
{<span class="hljs-symbol">:status</span> <span class="hljs-number">403</span>, <span class="hljs-symbol">:body</span> <span class="hljs-string">"forbidden"</span>}
|
||||
(<span class="hljs-name">handler</span> request)))))
|
||||
</code></pre>
|
||||
<p>Mounted to an app via router meta-data (effecting all routes):</p>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name"><span class="hljs-builtin-name">def</span></span> handler (<span class="hljs-name"><span class="hljs-builtin-name">constantly</span></span> {<span class="hljs-symbol">:status</span> <span class="hljs-number">200</span>, <span class="hljs-symbol">:body</span> <span class="hljs-string">"ok"</span>}))
|
||||
|
||||
(<span class="hljs-name"><span class="hljs-builtin-name">def</span></span> app
|
||||
(<span class="hljs-name">ring/ring-handler</span>
|
||||
(<span class="hljs-name">ring/router</span>
|
||||
[[<span class="hljs-string">"/api"</span>
|
||||
[<span class="hljs-string">"/ping"</span> handler]
|
||||
[<span class="hljs-string">"/admin"</span> {<span class="hljs-symbol">::roles</span> #{<span class="hljs-symbol">:admin</span>}}
|
||||
[<span class="hljs-string">"/ping"</span> handler]]]]
|
||||
{<span class="hljs-symbol">:meta</span> {<span class="hljs-symbol">:middleware</span> [wrap-enforce-roles]}})))
|
||||
</code></pre>
|
||||
<p>Anonymous access to public route:</p>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name">app</span> {<span class="hljs-symbol">:request-method</span> <span class="hljs-symbol">:get</span>, <span class="hljs-symbol">:uri</span> <span class="hljs-string">"/api/ping"</span>})
|
||||
<span class="hljs-comment">; {:status 200, :body "ok"}</span>
|
||||
</code></pre>
|
||||
<p>Anonymous access to guarded route:</p>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name">app</span> {<span class="hljs-symbol">:request-method</span> <span class="hljs-symbol">:get</span>, <span class="hljs-symbol">:uri</span> <span class="hljs-string">"/api/admin/ping"</span>})
|
||||
<span class="hljs-comment">; {:status 403, :body "forbidden"}</span>
|
||||
</code></pre>
|
||||
<p>Authorized access to guarded route:</p>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name">app</span> {<span class="hljs-symbol">:request-method</span> <span class="hljs-symbol">:get</span>, <span class="hljs-symbol">:uri</span> <span class="hljs-string">"/api/admin/ping"</span>, <span class="hljs-symbol">::roles</span> #{<span class="hljs-symbol">:admin</span>}})
|
||||
<span class="hljs-comment">; {:status 200, :body "ok"}</span>
|
||||
</code></pre>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
<div class="search-results">
|
||||
<div class="has-results">
|
||||
|
||||
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
|
||||
<ul class="search-results-list"></ul>
|
||||
|
||||
</div>
|
||||
<div class="no-results">
|
||||
|
||||
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<a href="ring.html" class="navigation navigation-prev " aria-label="Previous page: Ring-router">
|
||||
<i class="fa fa-angle-left"></i>
|
||||
</a>
|
||||
|
||||
|
||||
<a href="parameter_coercion.html" class="navigation navigation-next " aria-label="Next page: Parameter coercion">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Dynamic extensions","level":"1.4.2","depth":2,"next":{"title":"Parameter coercion","level":"1.4.3","depth":2,"path":"parameter_coercion.md","ref":"parameter_coercion.md","articles":[]},"previous":{"title":"Ring-router","level":"1.4.1","depth":2,"path":"ring.md","ref":"ring.md","articles":[]},"dir":"ltr"},"config":{"plugins":["editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"github":{"url":"https://github.com/metosin/reitit"},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"dynamic_extensions.md","mtime":"2017-10-25T15:00:22.836Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2017-10-25T15:01:14.084Z"},"basePath":".","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
|
||||
<script src="gitbook/gitbook.js"></script>
|
||||
<script src="gitbook/theme.js"></script>
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-editlink/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-github/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-search/search-engine.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-search/search.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-sharing/buttons.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
2
faq.html
2
faq.html
|
|
@ -949,7 +949,7 @@
|
|||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"FAQ","level":"8.3","depth":1,"previous":{"title":"Development Instructions","level":"8.2","depth":1,"path":"development.md","ref":"development.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"faq.md","mtime":"2020-01-14T13:47:50.979Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-24T11:08:28.724Z"},"basePath":".","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"FAQ","level":"8.3","depth":1,"previous":{"title":"Development Instructions","level":"8.2","depth":1,"path":"development.md","ref":"development.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"faq.md","mtime":"2020-01-14T13:47:50.979Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-28T09:52:25.779Z"},"basePath":".","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,5 +0,0 @@
|
|||
# Frontend
|
||||
|
||||
* [Basics](basics.md)
|
||||
* [Browser integration](browser.md)
|
||||
* [Controllers](controllers.md)
|
||||
|
|
@ -866,7 +866,7 @@ React breaking due to errors.</p>
|
|||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Basics","level":"6.1","depth":1,"next":{"title":"Browser integration","level":"6.2","depth":1,"path":"frontend/browser.md","ref":"frontend/browser.md","articles":[]},"previous":{"title":"Transforming Interceptor Chain","level":"5.5","depth":1,"path":"http/transforming_interceptor_chain.md","ref":"http/transforming_interceptor_chain.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"frontend/basics.md","mtime":"2020-01-14T13:47:50.980Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-24T11:08:28.724Z"},"basePath":"..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Basics","level":"6.1","depth":1,"next":{"title":"Browser integration","level":"6.2","depth":1,"path":"frontend/browser.md","ref":"frontend/browser.md","articles":[]},"previous":{"title":"Transforming Interceptor Chain","level":"5.5","depth":1,"path":"http/transforming_interceptor_chain.md","ref":"http/transforming_interceptor_chain.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"frontend/basics.md","mtime":"2020-01-14T13:47:50.980Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-28T09:52:25.779Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,3 +0,0 @@
|
|||
# Frontend basics
|
||||
|
||||
TODO
|
||||
|
|
@ -889,7 +889,7 @@ go back or forwards, but calling History API functions directly should work:</p>
|
|||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Browser integration","level":"6.2","depth":1,"next":{"title":"Controllers","level":"6.3","depth":1,"path":"frontend/controllers.md","ref":"frontend/controllers.md","articles":[]},"previous":{"title":"Basics","level":"6.1","depth":1,"path":"frontend/basics.md","ref":"frontend/basics.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"frontend/browser.md","mtime":"2020-01-14T13:47:50.981Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-24T11:08:28.724Z"},"basePath":"..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Browser integration","level":"6.2","depth":1,"next":{"title":"Controllers","level":"6.3","depth":1,"path":"frontend/controllers.md","ref":"frontend/controllers.md","articles":[]},"previous":{"title":"Basics","level":"6.1","depth":1,"path":"frontend/basics.md","ref":"frontend/basics.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"frontend/browser.md","mtime":"2020-01-14T13:47:50.981Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-28T09:52:25.779Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,3 +0,0 @@
|
|||
# Frontend browser integration
|
||||
|
||||
TODO
|
||||
|
|
@ -946,7 +946,7 @@ missing resources.</p>
|
|||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Controllers","level":"6.3","depth":1,"next":{"title":"Configuring Routers","level":"7.1","depth":1,"path":"advanced/configuring_routers.md","ref":"advanced/configuring_routers.md","articles":[]},"previous":{"title":"Browser integration","level":"6.2","depth":1,"path":"frontend/browser.md","ref":"frontend/browser.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"frontend/controllers.md","mtime":"2020-01-14T13:47:50.982Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-24T11:08:28.724Z"},"basePath":"..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Controllers","level":"6.3","depth":1,"next":{"title":"Configuring Routers","level":"7.1","depth":1,"path":"advanced/configuring_routers.md","ref":"advanced/configuring_routers.md","articles":[]},"previous":{"title":"Browser integration","level":"6.2","depth":1,"path":"frontend/browser.md","ref":"frontend/browser.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"frontend/controllers.md","mtime":"2020-01-14T13:47:50.982Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-28T09:52:25.779Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,3 +0,0 @@
|
|||
# Controllers
|
||||
|
||||
TODO
|
||||
|
|
@ -1,838 +0,0 @@
|
|||
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="" >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>Frontend · GitBook</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="description" content="">
|
||||
<meta name="generator" content="GitBook 3.2.3">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/style.css">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta name="HandheldFriendly" content="true"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
|
||||
<link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
|
||||
|
||||
|
||||
<link rel="next" href="basics.html" />
|
||||
|
||||
|
||||
<link rel="prev" href="../patterns/shared_routes.html" />
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="book">
|
||||
<div class="book-summary">
|
||||
|
||||
|
||||
<div id="book-search-input" role="search">
|
||||
<input type="text" placeholder="Type to search" />
|
||||
</div>
|
||||
|
||||
|
||||
<nav role="navigation">
|
||||
|
||||
|
||||
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1" data-path="../">
|
||||
|
||||
<a href="../">
|
||||
|
||||
|
||||
Introduction
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2" data-path="../basics/">
|
||||
|
||||
<a href="../basics/">
|
||||
|
||||
|
||||
Basics
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.2.1" data-path="../basics/route_syntax.html">
|
||||
|
||||
<a href="../basics/route_syntax.html">
|
||||
|
||||
|
||||
Route Syntax
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.2" data-path="../basics/router.html">
|
||||
|
||||
<a href="../basics/router.html">
|
||||
|
||||
|
||||
Router
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.3" data-path="../basics/path_based_routing.html">
|
||||
|
||||
<a href="../basics/path_based_routing.html">
|
||||
|
||||
|
||||
Path-based Routing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.4" data-path="../basics/name_based_routing.html">
|
||||
|
||||
<a href="../basics/name_based_routing.html">
|
||||
|
||||
|
||||
Name-based Routing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.5" data-path="../basics/route_data.html">
|
||||
|
||||
<a href="../basics/route_data.html">
|
||||
|
||||
|
||||
Route Data
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.6" data-path="../basics/route_data_validation.html">
|
||||
|
||||
<a href="../basics/route_data_validation.html">
|
||||
|
||||
|
||||
Route Data Validation
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.7" data-path="../basics/route_conflicts.html">
|
||||
|
||||
<a href="../basics/route_conflicts.html">
|
||||
|
||||
|
||||
Route Conflicts
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3" data-path="../coercion/">
|
||||
|
||||
<a href="../coercion/">
|
||||
|
||||
|
||||
Coercion
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.3.1" data-path="../coercion/coercion.html">
|
||||
|
||||
<a href="../coercion/coercion.html">
|
||||
|
||||
|
||||
Coercion Explained
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.2" data-path="../coercion/schema_coercion.html">
|
||||
|
||||
<a href="../coercion/schema_coercion.html">
|
||||
|
||||
|
||||
Plumatic Schema
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.3" data-path="../coercion/clojure_spec_coercion.html">
|
||||
|
||||
<a href="../coercion/clojure_spec_coercion.html">
|
||||
|
||||
|
||||
Clojure.spec
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.4" data-path="../coercion/data_spec_coercion.html">
|
||||
|
||||
<a href="../coercion/data_spec_coercion.html">
|
||||
|
||||
|
||||
Data-specs
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4" data-path="../ring/">
|
||||
|
||||
<a href="../ring/">
|
||||
|
||||
|
||||
Ring
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.4.1" data-path="../ring/ring.html">
|
||||
|
||||
<a href="../ring/ring.html">
|
||||
|
||||
|
||||
Ring-router
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.2" data-path="../ring/reverse_routing.html">
|
||||
|
||||
<a href="../ring/reverse_routing.html">
|
||||
|
||||
|
||||
Reverse-routing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.3" data-path="../ring/default_handler.html">
|
||||
|
||||
<a href="../ring/default_handler.html">
|
||||
|
||||
|
||||
Default handler
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.4" data-path="../ring/static.html">
|
||||
|
||||
<a href="../ring/static.html">
|
||||
|
||||
|
||||
Static Resources
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.5" data-path="../ring/dynamic_extensions.html">
|
||||
|
||||
<a href="../ring/dynamic_extensions.html">
|
||||
|
||||
|
||||
Dynamic Extensions
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.6" data-path="../ring/data_driven_middleware.html">
|
||||
|
||||
<a href="../ring/data_driven_middleware.html">
|
||||
|
||||
|
||||
Data-driven Middleware
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.7" data-path="../ring/transforming_middleware_chain.html">
|
||||
|
||||
<a href="../ring/transforming_middleware_chain.html">
|
||||
|
||||
|
||||
Transforming Middleware Chain
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.8" data-path="../ring/middleware_registry.html">
|
||||
|
||||
<a href="../ring/middleware_registry.html">
|
||||
|
||||
|
||||
Middleware Registry
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.9" data-path="../ring/default_middleware.html">
|
||||
|
||||
<a href="../ring/default_middleware.html">
|
||||
|
||||
|
||||
Default Middleware
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.10" data-path="../ring/coercion.html">
|
||||
|
||||
<a href="../ring/coercion.html">
|
||||
|
||||
|
||||
Pluggable Coercion
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.11" data-path="../ring/route_data_validation.html">
|
||||
|
||||
<a href="../ring/route_data_validation.html">
|
||||
|
||||
|
||||
Route Data Validation
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.12" data-path="../ring/compiling_middleware.html">
|
||||
|
||||
<a href="../ring/compiling_middleware.html">
|
||||
|
||||
|
||||
Compiling Middleware
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.13" data-path="../ring/swagger.html">
|
||||
|
||||
<a href="../ring/swagger.html">
|
||||
|
||||
|
||||
Swagger Support
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5" data-path="../advanced/">
|
||||
|
||||
<a href="../advanced/">
|
||||
|
||||
|
||||
Advanced
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.5.1" data-path="../advanced/configuring_routers.html">
|
||||
|
||||
<a href="../advanced/configuring_routers.html">
|
||||
|
||||
|
||||
Configuring Routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.2" data-path="../advanced/composing_routers.html">
|
||||
|
||||
<a href="../advanced/composing_routers.html">
|
||||
|
||||
|
||||
Composing Routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.3" data-path="../advanced/different_routers.html">
|
||||
|
||||
<a href="../advanced/different_routers.html">
|
||||
|
||||
|
||||
Different Routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.4" data-path="../advanced/route_validation.html">
|
||||
|
||||
<a href="../advanced/route_validation.html">
|
||||
|
||||
|
||||
Route Validation
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.5" data-path="../advanced/dev_workflow.html">
|
||||
|
||||
<a href="../advanced/dev_workflow.html">
|
||||
|
||||
|
||||
Dev Workflow
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.6" data-path="../patterns/">
|
||||
|
||||
<a href="../patterns/">
|
||||
|
||||
|
||||
Patterns
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.6.1" data-path="../patterns/shared_routes.html">
|
||||
|
||||
<a href="../patterns/shared_routes.html">
|
||||
|
||||
|
||||
Shared Routes
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter active" data-level="1.7" data-path="./">
|
||||
|
||||
<a href="./">
|
||||
|
||||
|
||||
Frontend
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.7.1" data-path="basics.html">
|
||||
|
||||
<a href="basics.html">
|
||||
|
||||
|
||||
Basics
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.7.2" data-path="browser.html">
|
||||
|
||||
<a href="browser.html">
|
||||
|
||||
|
||||
Browser integration
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.7.3" data-path="controllers.html">
|
||||
|
||||
<a href="controllers.html">
|
||||
|
||||
|
||||
Controllers (WIP)
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.8" data-path="../performance.html">
|
||||
|
||||
<a href="../performance.html">
|
||||
|
||||
|
||||
Performance
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.9" data-path="../interceptors.html">
|
||||
|
||||
<a href="../interceptors.html">
|
||||
|
||||
|
||||
Interceptors (WIP)
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.10" data-path="../development.html">
|
||||
|
||||
<a href="../development.html">
|
||||
|
||||
|
||||
Development Instructions
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.11" data-path="../faq.html">
|
||||
|
||||
<a href="../faq.html">
|
||||
|
||||
|
||||
FAQ
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
<li>
|
||||
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
|
||||
Published with GitBook
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="book-body">
|
||||
|
||||
<div class="body-inner">
|
||||
|
||||
|
||||
|
||||
<div class="book-header" role="navigation">
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
<i class="fa fa-circle-o-notch fa-spin"></i>
|
||||
<a href=".." >Frontend</a>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="page-wrapper" tabindex="-1" role="main">
|
||||
<div class="page-inner">
|
||||
|
||||
<div id="book-search-results">
|
||||
<div class="search-noresults">
|
||||
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<h1 id="frontend">Frontend</h1>
|
||||
<ul>
|
||||
<li><a href="basics.html">Basics</a></li>
|
||||
<li><a href="browser.html">Browser integration</a></li>
|
||||
<li><a href="controllers.html">Controllers (WIP)</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
<div class="search-results">
|
||||
<div class="has-results">
|
||||
|
||||
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
|
||||
<ul class="search-results-list"></ul>
|
||||
|
||||
</div>
|
||||
<div class="no-results">
|
||||
|
||||
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<a href="../patterns/shared_routes.html" class="navigation navigation-prev " aria-label="Previous page: Shared Routes">
|
||||
<i class="fa fa-angle-left"></i>
|
||||
</a>
|
||||
|
||||
|
||||
<a href="basics.html" class="navigation navigation-next " aria-label="Next page: Basics">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Frontend","level":"1.7","depth":1,"next":{"title":"Basics","level":"1.7.1","depth":2,"path":"frontend/basics.md","ref":"frontend/basics.md","articles":[]},"previous":{"title":"Shared Routes","level":"1.6.1","depth":2,"path":"patterns/shared_routes.md","ref":"patterns/shared_routes.md","articles":[]},"dir":"ltr"},"config":{"plugins":["editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"github":{"url":"https://github.com/metosin/reitit"},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"frontend/README.md","mtime":"2018-09-02T14:52:37.221Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-02T14:53:17.801Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook.js"></script>
|
||||
<script src="../gitbook/theme.js"></script>
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-editlink/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-github/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-search/search.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
@ -868,7 +868,7 @@
|
|||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Default Interceptors","level":"5.4","depth":1,"next":{"title":"Transforming Interceptor Chain","level":"5.5","depth":1,"path":"http/transforming_interceptor_chain.md","ref":"http/transforming_interceptor_chain.md","articles":[]},"previous":{"title":"Sieppari","level":"5.3","depth":1,"path":"http/sieppari.md","ref":"http/sieppari.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"http/default_interceptors.md","mtime":"2020-07-24T09:34:09.875Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-24T11:08:28.724Z"},"basePath":"..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Default Interceptors","level":"5.4","depth":1,"next":{"title":"Transforming Interceptor Chain","level":"5.5","depth":1,"path":"http/transforming_interceptor_chain.md","ref":"http/transforming_interceptor_chain.md","articles":[]},"previous":{"title":"Sieppari","level":"5.3","depth":1,"path":"http/sieppari.md","ref":"http/sieppari.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"http/default_interceptors.md","mtime":"2020-07-24T09:34:09.875Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-28T09:52:25.779Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -896,7 +896,7 @@
|
|||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Interceptors","level":"5.1","depth":1,"next":{"title":"Pedestal","level":"5.2","depth":1,"path":"http/pedestal.md","ref":"http/pedestal.md","articles":[]},"previous":{"title":"RESTful form methods","level":"4.17","depth":1,"path":"ring/RESTful_form_methods.md","ref":"ring/RESTful_form_methods.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"http/interceptors.md","mtime":"2020-07-24T11:06:54.686Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-24T11:08:28.724Z"},"basePath":"..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Interceptors","level":"5.1","depth":1,"next":{"title":"Pedestal","level":"5.2","depth":1,"path":"http/pedestal.md","ref":"http/pedestal.md","articles":[]},"previous":{"title":"RESTful form methods","level":"4.17","depth":1,"path":"ring/RESTful_form_methods.md","ref":"ring/RESTful_form_methods.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"http/interceptors.md","mtime":"2020-07-24T11:06:54.686Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-28T09:52:25.779Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -907,7 +907,7 @@
|
|||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Pedestal","level":"5.2","depth":1,"next":{"title":"Sieppari","level":"5.3","depth":1,"path":"http/sieppari.md","ref":"http/sieppari.md","articles":[]},"previous":{"title":"Interceptors","level":"5.1","depth":1,"path":"http/interceptors.md","ref":"http/interceptors.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"http/pedestal.md","mtime":"2020-07-24T09:34:09.876Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-24T11:08:28.724Z"},"basePath":"..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Pedestal","level":"5.2","depth":1,"next":{"title":"Sieppari","level":"5.3","depth":1,"path":"http/sieppari.md","ref":"http/sieppari.md","articles":[]},"previous":{"title":"Interceptors","level":"5.1","depth":1,"path":"http/interceptors.md","ref":"http/interceptors.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"http/pedestal.md","mtime":"2020-07-24T09:34:09.876Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-28T09:52:25.779Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -908,7 +908,7 @@
|
|||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Sieppari","level":"5.3","depth":1,"next":{"title":"Default Interceptors","level":"5.4","depth":1,"path":"http/default_interceptors.md","ref":"http/default_interceptors.md","articles":[]},"previous":{"title":"Pedestal","level":"5.2","depth":1,"path":"http/pedestal.md","ref":"http/pedestal.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"http/sieppari.md","mtime":"2020-07-24T09:34:09.876Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-24T11:08:28.724Z"},"basePath":"..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Sieppari","level":"5.3","depth":1,"next":{"title":"Default Interceptors","level":"5.4","depth":1,"path":"http/default_interceptors.md","ref":"http/default_interceptors.md","articles":[]},"previous":{"title":"Pedestal","level":"5.2","depth":1,"path":"http/pedestal.md","ref":"http/pedestal.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"http/sieppari.md","mtime":"2020-07-24T09:34:09.876Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-28T09:52:25.779Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -907,7 +907,7 @@
|
|||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Transforming Interceptor Chain","level":"5.5","depth":1,"next":{"title":"Basics","level":"6.1","depth":1,"path":"frontend/basics.md","ref":"frontend/basics.md","articles":[]},"previous":{"title":"Default Interceptors","level":"5.4","depth":1,"path":"http/default_interceptors.md","ref":"http/default_interceptors.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"http/transforming_interceptor_chain.md","mtime":"2020-07-24T09:34:09.876Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-24T11:08:28.724Z"},"basePath":"..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Transforming Interceptor Chain","level":"5.5","depth":1,"next":{"title":"Basics","level":"6.1","depth":1,"path":"frontend/basics.md","ref":"frontend/basics.md","articles":[]},"previous":{"title":"Default Interceptors","level":"5.4","depth":1,"path":"http/default_interceptors.md","ref":"http/default_interceptors.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"http/transforming_interceptor_chain.md","mtime":"2020-07-24T09:34:09.876Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-28T09:52:25.779Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -972,7 +972,7 @@
|
|||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Introduction","level":"1.1","depth":1,"next":{"title":"Route Syntax","level":"2.1","depth":1,"path":"basics/route_syntax.md","ref":"basics/route_syntax.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"README.md","mtime":"2020-07-24T09:34:09.873Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-24T11:08:28.724Z"},"basePath":".","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Introduction","level":"1.1","depth":1,"next":{"title":"Route Syntax","level":"2.1","depth":1,"path":"basics/route_syntax.md","ref":"basics/route_syntax.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"README.md","mtime":"2020-07-24T09:34:09.873Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-28T09:52:25.779Z"},"basePath":".","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,901 +0,0 @@
|
|||
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="" >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>Interceptors (WIP) · GitBook</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="description" content="">
|
||||
<meta name="generator" content="GitBook 3.2.3">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="gitbook/style.css">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="gitbook/gitbook-plugin-highlight/website.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="gitbook/gitbook-plugin-search/search.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta name="HandheldFriendly" content="true"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
|
||||
<link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">
|
||||
|
||||
|
||||
<link rel="next" href="development.html" />
|
||||
|
||||
|
||||
<link rel="prev" href="performance.html" />
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="book">
|
||||
<div class="book-summary">
|
||||
|
||||
|
||||
<div id="book-search-input" role="search">
|
||||
<input type="text" placeholder="Type to search" />
|
||||
</div>
|
||||
|
||||
|
||||
<nav role="navigation">
|
||||
|
||||
|
||||
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1" data-path="./">
|
||||
|
||||
<a href="./">
|
||||
|
||||
|
||||
Introduction
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2" data-path="basics/">
|
||||
|
||||
<a href="basics/">
|
||||
|
||||
|
||||
Basics
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.2.1" data-path="basics/route_syntax.html">
|
||||
|
||||
<a href="basics/route_syntax.html">
|
||||
|
||||
|
||||
Route Syntax
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.2" data-path="basics/router.html">
|
||||
|
||||
<a href="basics/router.html">
|
||||
|
||||
|
||||
Router
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.3" data-path="basics/path_based_routing.html">
|
||||
|
||||
<a href="basics/path_based_routing.html">
|
||||
|
||||
|
||||
Path-based Routing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.4" data-path="basics/name_based_routing.html">
|
||||
|
||||
<a href="basics/name_based_routing.html">
|
||||
|
||||
|
||||
Name-based Routing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.5" data-path="basics/route_data.html">
|
||||
|
||||
<a href="basics/route_data.html">
|
||||
|
||||
|
||||
Route Data
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.6" data-path="basics/route_data_validation.html">
|
||||
|
||||
<a href="basics/route_data_validation.html">
|
||||
|
||||
|
||||
Route Data Validation
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.7" data-path="basics/route_conflicts.html">
|
||||
|
||||
<a href="basics/route_conflicts.html">
|
||||
|
||||
|
||||
Route Conflicts
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3" data-path="coercion/">
|
||||
|
||||
<a href="coercion/">
|
||||
|
||||
|
||||
Coercion
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.3.1" data-path="coercion/coercion.html">
|
||||
|
||||
<a href="coercion/coercion.html">
|
||||
|
||||
|
||||
Coercion Explained
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.2" data-path="coercion/schema_coercion.html">
|
||||
|
||||
<a href="coercion/schema_coercion.html">
|
||||
|
||||
|
||||
Plumatic Schema
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.3" data-path="coercion/clojure_spec_coercion.html">
|
||||
|
||||
<a href="coercion/clojure_spec_coercion.html">
|
||||
|
||||
|
||||
Clojure.spec
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.4" data-path="coercion/data_spec_coercion.html">
|
||||
|
||||
<a href="coercion/data_spec_coercion.html">
|
||||
|
||||
|
||||
Data-specs
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4" data-path="ring/">
|
||||
|
||||
<a href="ring/">
|
||||
|
||||
|
||||
Ring
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.4.1" data-path="ring/ring.html">
|
||||
|
||||
<a href="ring/ring.html">
|
||||
|
||||
|
||||
Ring-router
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.2" data-path="ring/reverse_routing.html">
|
||||
|
||||
<a href="ring/reverse_routing.html">
|
||||
|
||||
|
||||
Reverse-routing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.3" data-path="ring/default_handler.html">
|
||||
|
||||
<a href="ring/default_handler.html">
|
||||
|
||||
|
||||
Default handler
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.4" data-path="ring/static.html">
|
||||
|
||||
<a href="ring/static.html">
|
||||
|
||||
|
||||
Static Resources
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.5" data-path="ring/dynamic_extensions.html">
|
||||
|
||||
<a href="ring/dynamic_extensions.html">
|
||||
|
||||
|
||||
Dynamic Extensions
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.6" data-path="ring/data_driven_middleware.html">
|
||||
|
||||
<a href="ring/data_driven_middleware.html">
|
||||
|
||||
|
||||
Data-driven Middleware
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.7" data-path="ring/transforming_middleware_chain.html">
|
||||
|
||||
<a href="ring/transforming_middleware_chain.html">
|
||||
|
||||
|
||||
Transforming Middleware Chain
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.8" data-path="ring/middleware_registry.html">
|
||||
|
||||
<a href="ring/middleware_registry.html">
|
||||
|
||||
|
||||
Middleware Registry
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.9" data-path="ring/default_middleware.html">
|
||||
|
||||
<a href="ring/default_middleware.html">
|
||||
|
||||
|
||||
Default Middleware
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.10" data-path="ring/coercion.html">
|
||||
|
||||
<a href="ring/coercion.html">
|
||||
|
||||
|
||||
Pluggable Coercion
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.11" data-path="ring/route_data_validation.html">
|
||||
|
||||
<a href="ring/route_data_validation.html">
|
||||
|
||||
|
||||
Route Data Validation
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.12" data-path="ring/compiling_middleware.html">
|
||||
|
||||
<a href="ring/compiling_middleware.html">
|
||||
|
||||
|
||||
Compiling Middleware
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.13" data-path="ring/swagger.html">
|
||||
|
||||
<a href="ring/swagger.html">
|
||||
|
||||
|
||||
Swagger Support
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5" data-path="advanced/">
|
||||
|
||||
<a href="advanced/">
|
||||
|
||||
|
||||
Advanced
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.5.1" data-path="advanced/configuring_routers.html">
|
||||
|
||||
<a href="advanced/configuring_routers.html">
|
||||
|
||||
|
||||
Configuring Routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.2" data-path="advanced/composing_routers.html">
|
||||
|
||||
<a href="advanced/composing_routers.html">
|
||||
|
||||
|
||||
Composing Routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.3" data-path="advanced/different_routers.html">
|
||||
|
||||
<a href="advanced/different_routers.html">
|
||||
|
||||
|
||||
Different Routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.4" data-path="advanced/route_validation.html">
|
||||
|
||||
<a href="advanced/route_validation.html">
|
||||
|
||||
|
||||
Route Validation
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.5" data-path="advanced/dev_workflow.html">
|
||||
|
||||
<a href="advanced/dev_workflow.html">
|
||||
|
||||
|
||||
Dev Workflow
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.6" data-path="patterns/">
|
||||
|
||||
<a href="patterns/">
|
||||
|
||||
|
||||
Patterns
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.6.1" data-path="patterns/shared_routes.html">
|
||||
|
||||
<a href="patterns/shared_routes.html">
|
||||
|
||||
|
||||
Shared Routes
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.7" data-path="frontend/">
|
||||
|
||||
<a href="frontend/">
|
||||
|
||||
|
||||
Frontend
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.7.1" data-path="frontend/basics.html">
|
||||
|
||||
<a href="frontend/basics.html">
|
||||
|
||||
|
||||
Basics
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.7.2" data-path="frontend/browser.html">
|
||||
|
||||
<a href="frontend/browser.html">
|
||||
|
||||
|
||||
Browser integration
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.7.3" data-path="frontend/controllers.html">
|
||||
|
||||
<a href="frontend/controllers.html">
|
||||
|
||||
|
||||
Controllers (WIP)
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.8" data-path="performance.html">
|
||||
|
||||
<a href="performance.html">
|
||||
|
||||
|
||||
Performance
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter active" data-level="1.9" data-path="interceptors.html">
|
||||
|
||||
<a href="interceptors.html">
|
||||
|
||||
|
||||
Interceptors (WIP)
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.10" data-path="development.html">
|
||||
|
||||
<a href="development.html">
|
||||
|
||||
|
||||
Development Instructions
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.11" data-path="faq.html">
|
||||
|
||||
<a href="faq.html">
|
||||
|
||||
|
||||
FAQ
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
<li>
|
||||
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
|
||||
Published with GitBook
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="book-body">
|
||||
|
||||
<div class="body-inner">
|
||||
|
||||
|
||||
|
||||
<div class="book-header" role="navigation">
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
<i class="fa fa-circle-o-notch fa-spin"></i>
|
||||
<a href="." >Interceptors (WIP)</a>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="page-wrapper" tabindex="-1" role="main">
|
||||
<div class="page-inner">
|
||||
|
||||
<div id="book-search-results">
|
||||
<div class="search-noresults">
|
||||
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<h1 id="interceptors-wip">Interceptors (WIP)</h1>
|
||||
<p>Reitit also support for <a href="pedestal.io">Pedestal</a>-style <a href="http://pedestal.io/reference/interceptors" target="_blank">interceptors</a> as an alternative to Middleware. Basic interceptor handling is implemented in <code>reitit.interceptor</code> package. There is no interceptor executor shipped, but you can use libraries like <a href="https://github.com/pedestal/pedestal/tree/master/interceptor" target="_blank">Pedestal Interceptor</a> or <a href="https://github.com/metosin/sieppari" target="_blank">Sieppari</a> to execute the chains.</p>
|
||||
<h2 id="reitit-http">Reitit-http</h2>
|
||||
<p>An alternative to <code>reitit-ring</code>, using interceptors instead of middleware. Currently not finalized, you can track progress in <a href="https://github.com/metosin/reitit/pull/124" target="_blank">here</a>.</p>
|
||||
<h2 id="examples">Examples</h2>
|
||||
<h3 id="standalone">Standalone</h3>
|
||||
<ul>
|
||||
<li><a href="https://github.com/metosin/sieppari" target="_blank">Sieppari</a> for executing the chain</li>
|
||||
<li><a href="https://github.com/ztellman/manifold" target="_blank">Manifold</a> for async</li>
|
||||
<li><a href="https://github.com/metosin/spec-tools/blob/master/README.md#data-specs" target="_blank">data-specs</a> for coercion</li>
|
||||
</ul>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name">require</span> '[reitit.interceptor.sieppari <span class="hljs-symbol">:as</span> sieppari])
|
||||
(<span class="hljs-name">require</span> '[reitit.http.coercion <span class="hljs-symbol">:as</span> coercion])
|
||||
(<span class="hljs-name">require</span> '[reitit.http <span class="hljs-symbol">:as</span> http])
|
||||
(<span class="hljs-name">require</span> '[reitit.ring <span class="hljs-symbol">:as</span> ring])
|
||||
(<span class="hljs-name">require</span> '[reitit.coercion.spec])
|
||||
(<span class="hljs-name">require</span> '[clojure.set <span class="hljs-symbol">:as</span> set])
|
||||
(<span class="hljs-name">require</span> '[manifold.deferred <span class="hljs-symbol">:as</span> d])
|
||||
(<span class="hljs-name">require</span> '[ring.adapter.jetty <span class="hljs-symbol">:as</span> jetty])
|
||||
|
||||
(<span class="hljs-name"><span class="hljs-builtin-name">def</span></span> auth-interceptor
|
||||
<span class="hljs-string">"Interceptor that mounts itself if route has `:roles` data. Expects `:roles`
|
||||
to be a set of keyword and the context to have `[:user :roles]` with user roles.
|
||||
responds with HTTP 403 if user doesn't have the roles defined, otherwise no-op."</span>
|
||||
{<span class="hljs-symbol">:name</span> <span class="hljs-symbol">::auth</span>
|
||||
<span class="hljs-symbol">:compile</span> (<span class="hljs-name"><span class="hljs-builtin-name">fn</span></span> [{<span class="hljs-symbol">:keys</span> [roles]} _]
|
||||
(<span class="hljs-name"><span class="hljs-builtin-name">if</span></span> (<span class="hljs-name"><span class="hljs-builtin-name">seq</span></span> roles)
|
||||
{<span class="hljs-symbol">:description</span> (<span class="hljs-name"><span class="hljs-builtin-name">str</span></span> <span class="hljs-string">"requires roles "</span> roles)
|
||||
<span class="hljs-symbol">:spec</span> {<span class="hljs-symbol">:roles</span> #{keyword?}}
|
||||
<span class="hljs-symbol">:context-spec</span> {<span class="hljs-symbol">:user</span> {<span class="hljs-symbol">:roles</span> #{keyword}}}
|
||||
<span class="hljs-symbol">:enter</span> (<span class="hljs-name"><span class="hljs-builtin-name">fn</span></span> [{{user-roles <span class="hljs-symbol">:roles</span>} <span class="hljs-symbol">:user</span> <span class="hljs-symbol">:as</span> ctx}]
|
||||
(<span class="hljs-name"><span class="hljs-builtin-name">if</span></span> (<span class="hljs-name"><span class="hljs-builtin-name">not</span></span> (<span class="hljs-name">set/subset?</span> roles user-roles))
|
||||
(<span class="hljs-name"><span class="hljs-builtin-name">assoc</span></span> ctx <span class="hljs-symbol">:response</span> {<span class="hljs-symbol">:status</span> <span class="hljs-number">403</span>, <span class="hljs-symbol">:body</span> <span class="hljs-string">"forbidden"</span>})
|
||||
ctx))}))})
|
||||
|
||||
(<span class="hljs-name"><span class="hljs-builtin-name">def</span></span> async-interceptor
|
||||
{<span class="hljs-symbol">:enter</span> (<span class="hljs-name"><span class="hljs-builtin-name">fn</span></span> [ctx] (<span class="hljs-name">d/future</span> ctx))})
|
||||
|
||||
(<span class="hljs-name"><span class="hljs-builtin-name">def</span></span> app
|
||||
(<span class="hljs-name">http/ring-handler</span>
|
||||
(<span class="hljs-name">http/router</span>
|
||||
[<span class="hljs-string">"/api"</span> {<span class="hljs-symbol">:interceptors</span> [async-interceptor auth-interceptor]}
|
||||
[<span class="hljs-string">"/ping"</span> {<span class="hljs-symbol">:name</span> <span class="hljs-symbol">::ping</span>
|
||||
<span class="hljs-symbol">:get</span> (<span class="hljs-name"><span class="hljs-builtin-name">constantly</span></span>
|
||||
{<span class="hljs-symbol">:status</span> <span class="hljs-number">200</span>
|
||||
<span class="hljs-symbol">:body</span> <span class="hljs-string">"pong"</span>})}]
|
||||
[<span class="hljs-string">"/plus/:z"</span> {<span class="hljs-symbol">:name</span> <span class="hljs-symbol">::plus</span>
|
||||
<span class="hljs-symbol">:post</span> {<span class="hljs-symbol">:parameters</span> {<span class="hljs-symbol">:query</span> {<span class="hljs-symbol">:x</span> int?}
|
||||
<span class="hljs-symbol">:body</span> {<span class="hljs-symbol">:y</span> int?}
|
||||
<span class="hljs-symbol">:path</span> {<span class="hljs-symbol">:z</span> int?}}
|
||||
<span class="hljs-symbol">:responses</span> {<span class="hljs-number">200</span> {<span class="hljs-symbol">:body</span> {<span class="hljs-symbol">:total</span> pos-int?}}}
|
||||
<span class="hljs-symbol">:roles</span> #{<span class="hljs-symbol">:admin</span>}
|
||||
<span class="hljs-symbol">:handler</span> (<span class="hljs-name"><span class="hljs-builtin-name">fn</span></span> [{<span class="hljs-symbol">:keys</span> [parameters]}]
|
||||
(<span class="hljs-name"><span class="hljs-builtin-name">let</span></span> [total (<span class="hljs-name"><span class="hljs-builtin-name">+</span></span> (<span class="hljs-name"><span class="hljs-builtin-name">-></span></span> parameters <span class="hljs-symbol">:query</span> <span class="hljs-symbol">:x</span>)
|
||||
(<span class="hljs-name"><span class="hljs-builtin-name">-></span></span> parameters <span class="hljs-symbol">:body</span> <span class="hljs-symbol">:y</span>)
|
||||
(<span class="hljs-name"><span class="hljs-builtin-name">-></span></span> parameters <span class="hljs-symbol">:path</span> <span class="hljs-symbol">:z</span>))]
|
||||
{<span class="hljs-symbol">:status</span> <span class="hljs-number">200</span>
|
||||
<span class="hljs-symbol">:body</span> {<span class="hljs-symbol">:total</span> total}}))}}]]
|
||||
{<span class="hljs-symbol">:data</span> {<span class="hljs-symbol">:coercion</span> reitit.coercion.spec/coercion
|
||||
<span class="hljs-symbol">:interceptors</span> [coercion/coerce-exceptions-interceptor
|
||||
coercion/coerce-request-interceptor
|
||||
coercion/coerce-response-interceptor]}})
|
||||
(<span class="hljs-name">ring/create-default-handler</span>)
|
||||
{<span class="hljs-symbol">:executor</span> sieppari/executor}))
|
||||
|
||||
(<span class="hljs-name">jetty/run-jetty</span> #'app {<span class="hljs-symbol">:port</span> <span class="hljs-number">3000</span>, <span class="hljs-symbol">:join?</span> <span class="hljs-literal">false</span>, <span class="hljs-symbol">:async?</span> <span class="hljs-literal">true</span>})
|
||||
</code></pre>
|
||||
<h3 id="pedestal">Pedestal</h3>
|
||||
<p><strong>TODO</strong></p>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
<div class="search-results">
|
||||
<div class="has-results">
|
||||
|
||||
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
|
||||
<ul class="search-results-list"></ul>
|
||||
|
||||
</div>
|
||||
<div class="no-results">
|
||||
|
||||
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<a href="performance.html" class="navigation navigation-prev " aria-label="Previous page: Performance">
|
||||
<i class="fa fa-angle-left"></i>
|
||||
</a>
|
||||
|
||||
|
||||
<a href="development.html" class="navigation navigation-next " aria-label="Next page: Development Instructions">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Interceptors (WIP)","level":"1.9","depth":1,"next":{"title":"Development Instructions","level":"1.10","depth":1,"path":"development.md","ref":"development.md","articles":[]},"previous":{"title":"Performance","level":"1.8","depth":1,"path":"performance.md","ref":"performance.md","articles":[]},"dir":"ltr"},"config":{"plugins":["editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"github":{"url":"https://github.com/metosin/reitit"},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"interceptors.md","mtime":"2018-09-02T14:52:37.221Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-02T14:53:17.801Z"},"basePath":".","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
|
||||
<script src="gitbook/gitbook.js"></script>
|
||||
<script src="gitbook/theme.js"></script>
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-editlink/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-github/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-search/search-engine.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-search/search.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-sharing/buttons.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
# Middleware Records
|
||||
|
||||
Reitit supports first-class data-driven middleware via `reitit.middleware/Middleware` records, created with `reitit.middleware/create` function. The following keys have special purpose:
|
||||
|
||||
| key | description |
|
||||
| -----------|-------------|
|
||||
| `:name` | Name of the middleware as qualified keyword (optional,recommended for libs)
|
||||
| `:wrap` | The actual middleware function of `handler args? => request => response`
|
||||
| `:gen` | Middleware compile function, see [compiling middleware](#compiling-middleware).
|
||||
|
||||
When routes are compiled, all middleware are expanded (and optionally compiled) into `Middleware` and stored in compilation results for later use (api-docs etc). For actual request processing, they are unwrapped into normal middleware functions producing zero runtime performance penalty. Middleware expansion is backed by `reitit.middleware/IntoMiddleware` protocol, enabling plain clojure(script) maps to be used.
|
||||
|
||||
A Record:
|
||||
|
||||
```clj
|
||||
(require '[reitit.middleware :as middleware])
|
||||
|
||||
(def wrap2
|
||||
(middleware/create
|
||||
{:name ::wrap2
|
||||
:description "a nice little mw, takes 1 arg."
|
||||
:wrap wrap}))
|
||||
```
|
||||
|
||||
As plain map:
|
||||
|
||||
```clj
|
||||
;; plain map
|
||||
(def wrap3
|
||||
{:name ::wrap3
|
||||
:description "a nice little mw, :api as arg"
|
||||
:wrap (fn [handler]
|
||||
(wrap handler :api))})
|
||||
```
|
||||
690
openapi.html
690
openapi.html
|
|
@ -1,690 +0,0 @@
|
|||
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="" >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>Swagger & Openapi (WIP) · GitBook</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="description" content="">
|
||||
<meta name="generator" content="GitBook 3.2.3">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="gitbook/style.css">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="gitbook/gitbook-plugin-highlight/website.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="gitbook/gitbook-plugin-search/search.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta name="HandheldFriendly" content="true"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
|
||||
<link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">
|
||||
|
||||
|
||||
<link rel="next" href="faq.html" />
|
||||
|
||||
|
||||
<link rel="prev" href="interceptors.html" />
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="book">
|
||||
<div class="book-summary">
|
||||
|
||||
|
||||
<div id="book-search-input" role="search">
|
||||
<input type="text" placeholder="Type to search" />
|
||||
</div>
|
||||
|
||||
|
||||
<nav role="navigation">
|
||||
|
||||
|
||||
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1" data-path="./">
|
||||
|
||||
<a href="./">
|
||||
|
||||
|
||||
Introduction
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2" data-path="basics/">
|
||||
|
||||
<a href="basics/">
|
||||
|
||||
|
||||
Basics
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.2.1" data-path="basics/route_syntax.html">
|
||||
|
||||
<a href="basics/route_syntax.html">
|
||||
|
||||
|
||||
Route Syntax
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.2" data-path="basics/router.html">
|
||||
|
||||
<a href="basics/router.html">
|
||||
|
||||
|
||||
Router
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.3" data-path="basics/path_based_routing.html">
|
||||
|
||||
<a href="basics/path_based_routing.html">
|
||||
|
||||
|
||||
Path-based Routing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.4" data-path="basics/name_based_routing.html">
|
||||
|
||||
<a href="basics/name_based_routing.html">
|
||||
|
||||
|
||||
Name-based Routing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.5" data-path="basics/route_data.html">
|
||||
|
||||
<a href="basics/route_data.html">
|
||||
|
||||
|
||||
Route Data
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.6" data-path="basics/route_data_validation.html">
|
||||
|
||||
<a href="basics/route_data_validation.html">
|
||||
|
||||
|
||||
Route Data Validation
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.7" data-path="basics/route_conflicts.html">
|
||||
|
||||
<a href="basics/route_conflicts.html">
|
||||
|
||||
|
||||
Route Conflicts
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3" data-path="coercion/">
|
||||
|
||||
<a href="coercion/">
|
||||
|
||||
|
||||
Coercion
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.3.1" data-path="coercion/coercion.html">
|
||||
|
||||
<a href="coercion/coercion.html">
|
||||
|
||||
|
||||
Coercion Explained
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.2" data-path="coercion/schema_coercion.html">
|
||||
|
||||
<a href="coercion/schema_coercion.html">
|
||||
|
||||
|
||||
Plumatic Schema
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.3" data-path="coercion/clojure_spec_coercion.html">
|
||||
|
||||
<a href="coercion/clojure_spec_coercion.html">
|
||||
|
||||
|
||||
Clojure.spec
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.4" data-path="coercion/data_spec_coercion.html">
|
||||
|
||||
<a href="coercion/data_spec_coercion.html">
|
||||
|
||||
|
||||
Data-specs
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4" data-path="advanced/">
|
||||
|
||||
<a href="advanced/">
|
||||
|
||||
|
||||
Advanced
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.4.1" data-path="advanced/configuring_routers.html">
|
||||
|
||||
<a href="advanced/configuring_routers.html">
|
||||
|
||||
|
||||
Configuring Routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.2" data-path="advanced/different_routers.html">
|
||||
|
||||
<a href="advanced/different_routers.html">
|
||||
|
||||
|
||||
Different Routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.3" data-path="advanced/route_validation.html">
|
||||
|
||||
<a href="advanced/route_validation.html">
|
||||
|
||||
|
||||
Route Validation
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.4" data-path="advanced/dev_workflow.html">
|
||||
|
||||
<a href="advanced/dev_workflow.html">
|
||||
|
||||
|
||||
Dev Workflow
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5" data-path="ring/">
|
||||
|
||||
<a href="ring/">
|
||||
|
||||
|
||||
Ring
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.5.1" data-path="ring/ring.html">
|
||||
|
||||
<a href="ring/ring.html">
|
||||
|
||||
|
||||
Ring-router
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.2" data-path="ring/dynamic_extensions.html">
|
||||
|
||||
<a href="ring/dynamic_extensions.html">
|
||||
|
||||
|
||||
Dynamic Extensions
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.3" data-path="ring/data_driven_middleware.html">
|
||||
|
||||
<a href="ring/data_driven_middleware.html">
|
||||
|
||||
|
||||
Data-driven Middleware
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.4" data-path="ring/coercion.html">
|
||||
|
||||
<a href="ring/coercion.html">
|
||||
|
||||
|
||||
Pluggable Coercion
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.5" data-path="ring/route_data_validation.html">
|
||||
|
||||
<a href="ring/route_data_validation.html">
|
||||
|
||||
|
||||
Route Data Validation
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.6" data-path="ring/compiling_middleware.html">
|
||||
|
||||
<a href="ring/compiling_middleware.html">
|
||||
|
||||
|
||||
Compiling Middleware
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.6" data-path="performance.html">
|
||||
|
||||
<a href="performance.html">
|
||||
|
||||
|
||||
Performance
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.7" data-path="interceptors.html">
|
||||
|
||||
<a href="interceptors.html">
|
||||
|
||||
|
||||
Interceptors (WIP)
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter active" data-level="1.8" data-path="openapi.html">
|
||||
|
||||
<a href="openapi.html">
|
||||
|
||||
|
||||
Swagger & Openapi (WIP)
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.9" data-path="faq.html">
|
||||
|
||||
<a href="faq.html">
|
||||
|
||||
|
||||
FAQ
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
<li>
|
||||
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
|
||||
Published with GitBook
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="book-body">
|
||||
|
||||
<div class="body-inner">
|
||||
|
||||
|
||||
|
||||
<div class="book-header" role="navigation">
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
<i class="fa fa-circle-o-notch fa-spin"></i>
|
||||
<a href="." >Swagger & Openapi (WIP)</a>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="page-wrapper" tabindex="-1" role="main">
|
||||
<div class="page-inner">
|
||||
|
||||
<div id="book-search-results">
|
||||
<div class="search-noresults">
|
||||
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<h1 id="swagger--openapi-wip">Swagger & OpenAPI (WIP)</h1>
|
||||
<p>Goal is to support both <a href="https://swagger.io/" target="_blank">Swagger</a> & <a href="https://www.openapis.org/" target="_blank">OpenAPI</a> for route documentation. Documentation is extracted from existing coercion definitions <code>:parameters</code>, <code>:responses</code> and from a set of new doumentation keys.</p>
|
||||
<p>Swagger-support draft works, but only for Clojure.</p>
|
||||
<h3 id="todo">TODO</h3>
|
||||
<ul>
|
||||
<li><a href="https://github.com/metosin/schema-tools/issues/38" target="_blank">metosin/schema-tools#38</a>: extract Schema-swagger from <a href="https://github.com/metosin/ring-swagger" target="_blank">ring-swagger</a> into <a href="https://github.com/metosin/schema-tools" target="_blank">schema-tools</a> to support both Clojure & ClojureScript</li>
|
||||
<li>separate modules for the swagger2 & openapi</li>
|
||||
<li><a href="https://github.com/metosin/spec-tools/issues/105" target="_blank">metosin/spec-tools#105</a>: support Openapi</li>
|
||||
</ul>
|
||||
<h3 id="example">Example</h3>
|
||||
<p>Current <code>reitit-swagger</code> draft (with <code>reitit-ring</code> & data-specs):</p>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name">require</span> '[reitit.ring <span class="hljs-symbol">:as</span> ring])
|
||||
(<span class="hljs-name">require</span> '[reitit.ring.swagger <span class="hljs-symbol">:as</span> swagger])
|
||||
(<span class="hljs-name">require</span> '[reitit.ring.coercion <span class="hljs-symbol">:as</span> rrc])
|
||||
(<span class="hljs-name">require</span> '[reitit.coercion.spec <span class="hljs-symbol">:as</span> spec])
|
||||
|
||||
(<span class="hljs-name"><span class="hljs-builtin-name">def</span></span> app
|
||||
(<span class="hljs-name">ring/ring-handler</span>
|
||||
(<span class="hljs-name">ring/router</span>
|
||||
[<span class="hljs-string">"/api"</span>
|
||||
<span class="hljs-comment">;; identify a swagger api</span>
|
||||
<span class="hljs-comment">;; there can be several in a routing tree</span>
|
||||
{<span class="hljs-symbol">:swagger</span> {<span class="hljs-symbol">:id</span> <span class="hljs-symbol">:math</span>}}
|
||||
|
||||
<span class="hljs-comment">;; the (undocumented) swagger spec endpoint</span>
|
||||
[<span class="hljs-string">"/swagger.json"</span>
|
||||
{<span class="hljs-symbol">:get</span> {<span class="hljs-symbol">:no-doc</span> <span class="hljs-literal">true</span>
|
||||
<span class="hljs-symbol">:swagger</span> {<span class="hljs-symbol">:info</span> {<span class="hljs-symbol">:title</span> <span class="hljs-string">"my-api"</span>}}
|
||||
<span class="hljs-symbol">:handler</span> swagger/swagger-spec-handler}}]
|
||||
|
||||
[<span class="hljs-string">"/minus"</span>
|
||||
{<span class="hljs-symbol">:get</span> {<span class="hljs-symbol">:summary</span> <span class="hljs-string">"minus"</span>
|
||||
<span class="hljs-symbol">:parameters</span> {<span class="hljs-symbol">:query</span> {<span class="hljs-symbol">:x</span> int?, <span class="hljs-symbol">:y</span> int?}}
|
||||
<span class="hljs-symbol">:responses</span> {<span class="hljs-number">200</span> {<span class="hljs-symbol">:body</span> {<span class="hljs-symbol">:total</span> int?}}}
|
||||
<span class="hljs-symbol">:handler</span> (<span class="hljs-name"><span class="hljs-builtin-name">fn</span></span> [{{{<span class="hljs-symbol">:keys</span> [x y]} <span class="hljs-symbol">:query</span>} <span class="hljs-symbol">:parameters</span>}]
|
||||
{<span class="hljs-symbol">:status</span> <span class="hljs-number">200</span>, <span class="hljs-symbol">:body</span> {<span class="hljs-symbol">:total</span> (<span class="hljs-name"><span class="hljs-builtin-name">-</span></span> x y)}})}}]
|
||||
|
||||
[<span class="hljs-string">"/plus"</span>
|
||||
{<span class="hljs-symbol">:get</span> {<span class="hljs-symbol">:summary</span> <span class="hljs-string">"plus"</span>
|
||||
<span class="hljs-symbol">:parameters</span> {<span class="hljs-symbol">:query</span> {<span class="hljs-symbol">:x</span> int?, <span class="hljs-symbol">:y</span> int?}}
|
||||
<span class="hljs-symbol">:responses</span> {<span class="hljs-number">200</span> {<span class="hljs-symbol">:body</span> {<span class="hljs-symbol">:total</span> int?}}}
|
||||
<span class="hljs-symbol">:handler</span> (<span class="hljs-name"><span class="hljs-builtin-name">fn</span></span> [{{{<span class="hljs-symbol">:keys</span> [x y]} <span class="hljs-symbol">:query</span>} <span class="hljs-symbol">:parameters</span>}]
|
||||
{<span class="hljs-symbol">:status</span> <span class="hljs-number">200</span>, <span class="hljs-symbol">:body</span> {<span class="hljs-symbol">:total</span> (<span class="hljs-name"><span class="hljs-builtin-name">+</span></span> x y)}})}}]]
|
||||
|
||||
{<span class="hljs-symbol">:data</span> {<span class="hljs-symbol">:middleware</span> [<span class="hljs-comment">;; does not particiate in request processing</span>
|
||||
<span class="hljs-comment">;; just defines specs for the extra keys</span>
|
||||
swagger/swagger-middleware
|
||||
rrc/coerce-exceptions-middleware
|
||||
rrc/coerce-request-middleware
|
||||
rrc/coerce-response-middleware]
|
||||
<span class="hljs-symbol">:coercion</span> spec/coercion}})))
|
||||
</code></pre>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
<div class="search-results">
|
||||
<div class="has-results">
|
||||
|
||||
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
|
||||
<ul class="search-results-list"></ul>
|
||||
|
||||
</div>
|
||||
<div class="no-results">
|
||||
|
||||
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<a href="interceptors.html" class="navigation navigation-prev " aria-label="Previous page: Interceptors (WIP)">
|
||||
<i class="fa fa-angle-left"></i>
|
||||
</a>
|
||||
|
||||
|
||||
<a href="faq.html" class="navigation navigation-next " aria-label="Next page: FAQ">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Swagger & Openapi (WIP)","level":"1.8","depth":1,"next":{"title":"FAQ","level":"1.9","depth":1,"path":"faq.md","ref":"faq.md","articles":[]},"previous":{"title":"Interceptors (WIP)","level":"1.7","depth":1,"path":"interceptors.md","ref":"interceptors.md","articles":[]},"dir":"ltr"},"config":{"plugins":["editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"github":{"url":"https://github.com/metosin/reitit"},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"openapi.md","mtime":"2018-04-20T05:30:31.981Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-04-20T05:31:14.403Z"},"basePath":".","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
|
||||
<script src="gitbook/gitbook.js"></script>
|
||||
<script src="gitbook/theme.js"></script>
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-editlink/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-github/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-search/search-engine.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-search/search.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-sharing/buttons.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
@ -1,565 +0,0 @@
|
|||
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="" >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>Parameter coercion · GitBook</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="description" content="">
|
||||
<meta name="generator" content="GitBook 3.2.3">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="gitbook/style.css">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="gitbook/gitbook-plugin-highlight/website.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="gitbook/gitbook-plugin-search/search.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta name="HandheldFriendly" content="true"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
|
||||
<link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">
|
||||
|
||||
|
||||
<link rel="next" href="compiling_middleware.html" />
|
||||
|
||||
|
||||
<link rel="prev" href="dynamic_extensions.html" />
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="book">
|
||||
<div class="book-summary">
|
||||
|
||||
|
||||
<div id="book-search-input" role="search">
|
||||
<input type="text" placeholder="Type to search" />
|
||||
</div>
|
||||
|
||||
|
||||
<nav role="navigation">
|
||||
|
||||
|
||||
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1" data-path="./">
|
||||
|
||||
<a href="./">
|
||||
|
||||
|
||||
Introduction
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
Basics
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.2.1" data-path="basics.html">
|
||||
|
||||
<a href="basics.html#route-syntax">
|
||||
|
||||
|
||||
Route syntax
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.2" data-path="basics.html">
|
||||
|
||||
<a href="basics.html#router">
|
||||
|
||||
|
||||
Router
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.3" data-path="basics.html">
|
||||
|
||||
<a href="basics.html#path-based-routing">
|
||||
|
||||
|
||||
Path-based Routing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.4" data-path="basics.html">
|
||||
|
||||
<a href="basics.html#name-based-routing">
|
||||
|
||||
|
||||
Name-based Routing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.5" data-path="basics.html">
|
||||
|
||||
<a href="basics.html#route-data">
|
||||
|
||||
|
||||
Route data
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.6" data-path="basics.html">
|
||||
|
||||
<a href="basics.html#different-routers">
|
||||
|
||||
|
||||
Different Routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
Advanced
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.3.1" data-path="route_conflicts.html">
|
||||
|
||||
<a href="route_conflicts.html">
|
||||
|
||||
|
||||
Route conflicts
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.2" data-path="route_validation.html">
|
||||
|
||||
<a href="route_validation.html">
|
||||
|
||||
|
||||
Route Validation
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.3" data-path="configuring_routers.html">
|
||||
|
||||
<a href="configuring_routers.html">
|
||||
|
||||
|
||||
Configuring routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
Ring
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.4.1" data-path="ring.html">
|
||||
|
||||
<a href="ring.html">
|
||||
|
||||
|
||||
Ring-router
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.2" data-path="dynamic_extensions.html">
|
||||
|
||||
<a href="dynamic_extensions.html">
|
||||
|
||||
|
||||
Dynamic extensions
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter active" data-level="1.4.3" data-path="parameter_coercion.html">
|
||||
|
||||
<a href="parameter_coercion.html">
|
||||
|
||||
|
||||
Parameter coercion
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.4" data-path="compiling_middleware.html">
|
||||
|
||||
<a href="compiling_middleware.html">
|
||||
|
||||
|
||||
Compiling middleware
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
TODO: Swagger & OpenAPI
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.6" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
TODO: Interceptors
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
<li>
|
||||
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
|
||||
Published with GitBook
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="book-body">
|
||||
|
||||
<div class="body-inner">
|
||||
|
||||
|
||||
|
||||
<div class="book-header" role="navigation">
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
<i class="fa fa-circle-o-notch fa-spin"></i>
|
||||
<a href="." >Parameter coercion</a>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="page-wrapper" tabindex="-1" role="main">
|
||||
<div class="page-inner">
|
||||
|
||||
<div id="book-search-results">
|
||||
<div class="search-noresults">
|
||||
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<h1 id="parameter-coercion">Parameter coercion</h1>
|
||||
<p>Reitit provides pluggable parameter coercion via <code>reitit.coercion.protocol/Coercion</code> protocol, originally introduced in <a href="https://clojars.org/metosin/compojure-api" target="_blank">compojure-api</a>. Reitit ships with <code>reitit.coercion.spec/SpecCoercion</code> providing implemenation for <a href="https://clojure.org/about/spec" target="_blank">clojure.spec</a> and <a href="https://github.com/metosin/spec-tools#data-specs" target="_blank">data-specs</a>.</p>
|
||||
<p><strong>NOTE</strong>: Before Clojure 1.9.0 is shipped, to use the spec-coercion, one needs to add the following dependencies manually to the project:</p>
|
||||
<pre><code class="lang-clj">[org.clojure/clojure <span class="hljs-string">"1.9.0-alpha20"</span>]
|
||||
[org.clojure/spec.alpha <span class="hljs-string">"0.1.123"</span>]
|
||||
[metosin/spec-tools <span class="hljs-string">"0.3.3"</span>]
|
||||
</code></pre>
|
||||
<h3 id="ring-request-and-response-coercion">Ring request and response coercion</h3>
|
||||
<p>To use <code>Coercion</code> with Ring, one needs to do the following:</p>
|
||||
<ol>
|
||||
<li>Define parameters and responses as data into route meta-data, in format adopted from <a href="https://github.com/metosin/ring-swagger#more-complete-example" target="_blank">ring-swagger</a>:<ul>
|
||||
<li><code>:parameters</code> map, with submaps for different parameters: <code>:query</code>, <code>:body</code>, <code>:form</code>, <code>:header</code> and <code>:path</code>. Parameters are defined in the format understood by the <code>Coercion</code>.</li>
|
||||
<li><code>:responses</code> map, with response status codes as keys (or <code>:default</code> for "everything else") with maps with <code>:schema</code> and optionally <code>:description</code> as values.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Define a <code>Coercion</code> to route meta-data under <code>:coercion</code></li>
|
||||
<li>Mount request & response coercion middleware to the routes.</li>
|
||||
</ol>
|
||||
<p>If the request coercion succeeds, the coerced parameters are injected into request under <code>:parameters</code>.</p>
|
||||
<p>If either request or response coercion fails, an descriptive error is thrown.</p>
|
||||
<h4 id="example-with-data-specs">Example with data-specs</h4>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name">require</span> '[reitit.ring <span class="hljs-symbol">:as</span> ring])
|
||||
(<span class="hljs-name">require</span> '[reitit.coercion <span class="hljs-symbol">:as</span> coercion])
|
||||
(<span class="hljs-name">require</span> '[reitit.coercion.spec <span class="hljs-symbol">:as</span> spec])
|
||||
|
||||
(<span class="hljs-name"><span class="hljs-builtin-name">def</span></span> app
|
||||
(<span class="hljs-name">ring/ring-handler</span>
|
||||
(<span class="hljs-name">ring/router</span>
|
||||
[<span class="hljs-string">"/api"</span>
|
||||
[<span class="hljs-string">"/ping"</span> {<span class="hljs-symbol">:parameters</span> {<span class="hljs-symbol">:body</span> {<span class="hljs-symbol">:x</span> int?, <span class="hljs-symbol">:y</span> int?}}
|
||||
<span class="hljs-symbol">:responses</span> {<span class="hljs-number">200</span> {<span class="hljs-symbol">:schema</span> {<span class="hljs-symbol">:total</span> pos-int?}}}
|
||||
<span class="hljs-symbol">:get</span> {<span class="hljs-symbol">:handler</span> (<span class="hljs-name"><span class="hljs-builtin-name">fn</span></span> [{{{<span class="hljs-symbol">:keys</span> [x y]} <span class="hljs-symbol">:body</span>} <span class="hljs-symbol">:parameters</span>}]
|
||||
{<span class="hljs-symbol">:status</span> <span class="hljs-number">200</span>
|
||||
<span class="hljs-symbol">:body</span> {<span class="hljs-symbol">:total</span> (<span class="hljs-name"><span class="hljs-builtin-name">+</span></span> x y)}})}}]]
|
||||
{<span class="hljs-symbol">:meta</span> {<span class="hljs-symbol">:middleware</span> [coercion/gen-wrap-coerce-parameters
|
||||
coercion/gen-wrap-coerce-response]
|
||||
<span class="hljs-symbol">:coercion</span> spec/coercion}})))
|
||||
</code></pre>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name">app</span>
|
||||
{<span class="hljs-symbol">:request-method</span> <span class="hljs-symbol">:get</span>
|
||||
<span class="hljs-symbol">:uri</span> <span class="hljs-string">"/api/ping"</span>
|
||||
<span class="hljs-symbol">:body-params</span> {<span class="hljs-symbol">:x</span> <span class="hljs-number">1</span>, <span class="hljs-symbol">:y</span> <span class="hljs-number">2</span>}})
|
||||
<span class="hljs-comment">; {:status 200, :body {:total 3}}</span>
|
||||
</code></pre>
|
||||
<h4 id="example-with-specs">Example with specs</h4>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name">require</span> '[reitit.ring <span class="hljs-symbol">:as</span> ring])
|
||||
(<span class="hljs-name">require</span> '[reitit.coercion <span class="hljs-symbol">:as</span> coercion])
|
||||
(<span class="hljs-name">require</span> '[reitit.coercion.spec <span class="hljs-symbol">:as</span> spec])
|
||||
(<span class="hljs-name">require</span> '[clojure.spec.alpha <span class="hljs-symbol">:as</span> s])
|
||||
(<span class="hljs-name">require</span> '[spec-tools.core <span class="hljs-symbol">:as</span> st])
|
||||
|
||||
(<span class="hljs-name">s/def</span> <span class="hljs-symbol">::x</span> (<span class="hljs-name">st/spec</span> int?))
|
||||
(<span class="hljs-name">s/def</span> <span class="hljs-symbol">::y</span> (<span class="hljs-name">st/spec</span> int?))
|
||||
(<span class="hljs-name">s/def</span> <span class="hljs-symbol">::total</span> int?)
|
||||
(<span class="hljs-name">s/def</span> <span class="hljs-symbol">::request</span> (<span class="hljs-name">s/keys</span> <span class="hljs-symbol">:req-un</span> [<span class="hljs-symbol">::x</span> <span class="hljs-symbol">::y</span>]))
|
||||
(<span class="hljs-name">s/def</span> <span class="hljs-symbol">::response</span> (<span class="hljs-name">s/keys</span> <span class="hljs-symbol">:req-un</span> [<span class="hljs-symbol">::total</span>]))
|
||||
|
||||
(<span class="hljs-name"><span class="hljs-builtin-name">def</span></span> app
|
||||
(<span class="hljs-name">ring/ring-handler</span>
|
||||
(<span class="hljs-name">ring/router</span>
|
||||
[<span class="hljs-string">"/api"</span>
|
||||
[<span class="hljs-string">"/ping"</span> {<span class="hljs-symbol">:parameters</span> {<span class="hljs-symbol">:body</span> <span class="hljs-symbol">::request</span>}
|
||||
<span class="hljs-symbol">:responses</span> {<span class="hljs-number">200</span> {<span class="hljs-symbol">:schema</span> <span class="hljs-symbol">::response</span>}}
|
||||
<span class="hljs-symbol">:get</span> {<span class="hljs-symbol">:handler</span> (<span class="hljs-name"><span class="hljs-builtin-name">fn</span></span> [{{{<span class="hljs-symbol">:keys</span> [x y]} <span class="hljs-symbol">:body</span>} <span class="hljs-symbol">:parameters</span>}]
|
||||
{<span class="hljs-symbol">:status</span> <span class="hljs-number">200</span>
|
||||
<span class="hljs-symbol">:body</span> {<span class="hljs-symbol">:total</span> (<span class="hljs-name"><span class="hljs-builtin-name">+</span></span> x y)}})}}]]
|
||||
{<span class="hljs-symbol">:meta</span> {<span class="hljs-symbol">:middleware</span> [coercion/gen-wrap-coerce-parameters
|
||||
coercion/gen-wrap-coerce-response]
|
||||
<span class="hljs-symbol">:coercion</span> spec/coercion}})))
|
||||
</code></pre>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name">app</span>
|
||||
{<span class="hljs-symbol">:request-method</span> <span class="hljs-symbol">:get</span>
|
||||
<span class="hljs-symbol">:uri</span> <span class="hljs-string">"/api/ping"</span>
|
||||
<span class="hljs-symbol">:body-params</span> {<span class="hljs-symbol">:x</span> <span class="hljs-number">1</span>, <span class="hljs-symbol">:y</span> <span class="hljs-number">2</span>}})
|
||||
<span class="hljs-comment">; {:status 200, :body {:total 3}}</span>
|
||||
</code></pre>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
<div class="search-results">
|
||||
<div class="has-results">
|
||||
|
||||
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
|
||||
<ul class="search-results-list"></ul>
|
||||
|
||||
</div>
|
||||
<div class="no-results">
|
||||
|
||||
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<a href="dynamic_extensions.html" class="navigation navigation-prev " aria-label="Previous page: Dynamic extensions">
|
||||
<i class="fa fa-angle-left"></i>
|
||||
</a>
|
||||
|
||||
|
||||
<a href="compiling_middleware.html" class="navigation navigation-next " aria-label="Next page: Compiling middleware">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Parameter coercion","level":"1.4.3","depth":2,"next":{"title":"Compiling middleware","level":"1.4.4","depth":2,"path":"compiling_middleware.md","ref":"compiling_middleware.md","articles":[]},"previous":{"title":"Dynamic extensions","level":"1.4.2","depth":2,"path":"dynamic_extensions.md","ref":"dynamic_extensions.md","articles":[]},"dir":"ltr"},"config":{"plugins":["editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"github":{"url":"https://github.com/metosin/reitit"},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"parameter_coercion.md","mtime":"2017-10-25T15:00:22.836Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2017-10-25T15:01:14.084Z"},"basePath":".","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
|
||||
<script src="gitbook/gitbook.js"></script>
|
||||
<script src="gitbook/theme.js"></script>
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-editlink/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-github/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-search/search-engine.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-search/search.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-sharing/buttons.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
@ -1,836 +0,0 @@
|
|||
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="" >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>Patterns · GitBook</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="description" content="">
|
||||
<meta name="generator" content="GitBook 3.2.3">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/style.css">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta name="HandheldFriendly" content="true"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
|
||||
<link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
|
||||
|
||||
|
||||
<link rel="next" href="shared_routes.html" />
|
||||
|
||||
|
||||
<link rel="prev" href="../advanced/dev_workflow.html" />
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="book">
|
||||
<div class="book-summary">
|
||||
|
||||
|
||||
<div id="book-search-input" role="search">
|
||||
<input type="text" placeholder="Type to search" />
|
||||
</div>
|
||||
|
||||
|
||||
<nav role="navigation">
|
||||
|
||||
|
||||
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1" data-path="../">
|
||||
|
||||
<a href="../">
|
||||
|
||||
|
||||
Introduction
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2" data-path="../basics/">
|
||||
|
||||
<a href="../basics/">
|
||||
|
||||
|
||||
Basics
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.2.1" data-path="../basics/route_syntax.html">
|
||||
|
||||
<a href="../basics/route_syntax.html">
|
||||
|
||||
|
||||
Route Syntax
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.2" data-path="../basics/router.html">
|
||||
|
||||
<a href="../basics/router.html">
|
||||
|
||||
|
||||
Router
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.3" data-path="../basics/path_based_routing.html">
|
||||
|
||||
<a href="../basics/path_based_routing.html">
|
||||
|
||||
|
||||
Path-based Routing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.4" data-path="../basics/name_based_routing.html">
|
||||
|
||||
<a href="../basics/name_based_routing.html">
|
||||
|
||||
|
||||
Name-based Routing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.5" data-path="../basics/route_data.html">
|
||||
|
||||
<a href="../basics/route_data.html">
|
||||
|
||||
|
||||
Route Data
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.6" data-path="../basics/route_data_validation.html">
|
||||
|
||||
<a href="../basics/route_data_validation.html">
|
||||
|
||||
|
||||
Route Data Validation
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.7" data-path="../basics/route_conflicts.html">
|
||||
|
||||
<a href="../basics/route_conflicts.html">
|
||||
|
||||
|
||||
Route Conflicts
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3" data-path="../coercion/">
|
||||
|
||||
<a href="../coercion/">
|
||||
|
||||
|
||||
Coercion
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.3.1" data-path="../coercion/coercion.html">
|
||||
|
||||
<a href="../coercion/coercion.html">
|
||||
|
||||
|
||||
Coercion Explained
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.2" data-path="../coercion/schema_coercion.html">
|
||||
|
||||
<a href="../coercion/schema_coercion.html">
|
||||
|
||||
|
||||
Plumatic Schema
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.3" data-path="../coercion/clojure_spec_coercion.html">
|
||||
|
||||
<a href="../coercion/clojure_spec_coercion.html">
|
||||
|
||||
|
||||
Clojure.spec
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.4" data-path="../coercion/data_spec_coercion.html">
|
||||
|
||||
<a href="../coercion/data_spec_coercion.html">
|
||||
|
||||
|
||||
Data-specs
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4" data-path="../ring/">
|
||||
|
||||
<a href="../ring/">
|
||||
|
||||
|
||||
Ring
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.4.1" data-path="../ring/ring.html">
|
||||
|
||||
<a href="../ring/ring.html">
|
||||
|
||||
|
||||
Ring-router
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.2" data-path="../ring/reverse_routing.html">
|
||||
|
||||
<a href="../ring/reverse_routing.html">
|
||||
|
||||
|
||||
Reverse-routing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.3" data-path="../ring/default_handler.html">
|
||||
|
||||
<a href="../ring/default_handler.html">
|
||||
|
||||
|
||||
Default handler
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.4" data-path="../ring/static.html">
|
||||
|
||||
<a href="../ring/static.html">
|
||||
|
||||
|
||||
Static Resources
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.5" data-path="../ring/dynamic_extensions.html">
|
||||
|
||||
<a href="../ring/dynamic_extensions.html">
|
||||
|
||||
|
||||
Dynamic Extensions
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.6" data-path="../ring/data_driven_middleware.html">
|
||||
|
||||
<a href="../ring/data_driven_middleware.html">
|
||||
|
||||
|
||||
Data-driven Middleware
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.7" data-path="../ring/transforming_middleware_chain.html">
|
||||
|
||||
<a href="../ring/transforming_middleware_chain.html">
|
||||
|
||||
|
||||
Transforming Middleware Chain
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.8" data-path="../ring/middleware_registry.html">
|
||||
|
||||
<a href="../ring/middleware_registry.html">
|
||||
|
||||
|
||||
Middleware Registry
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.9" data-path="../ring/default_middleware.html">
|
||||
|
||||
<a href="../ring/default_middleware.html">
|
||||
|
||||
|
||||
Default Middleware
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.10" data-path="../ring/coercion.html">
|
||||
|
||||
<a href="../ring/coercion.html">
|
||||
|
||||
|
||||
Pluggable Coercion
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.11" data-path="../ring/route_data_validation.html">
|
||||
|
||||
<a href="../ring/route_data_validation.html">
|
||||
|
||||
|
||||
Route Data Validation
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.12" data-path="../ring/compiling_middleware.html">
|
||||
|
||||
<a href="../ring/compiling_middleware.html">
|
||||
|
||||
|
||||
Compiling Middleware
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.13" data-path="../ring/swagger.html">
|
||||
|
||||
<a href="../ring/swagger.html">
|
||||
|
||||
|
||||
Swagger Support
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5" data-path="../advanced/">
|
||||
|
||||
<a href="../advanced/">
|
||||
|
||||
|
||||
Advanced
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.5.1" data-path="../advanced/configuring_routers.html">
|
||||
|
||||
<a href="../advanced/configuring_routers.html">
|
||||
|
||||
|
||||
Configuring Routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.2" data-path="../advanced/composing_routers.html">
|
||||
|
||||
<a href="../advanced/composing_routers.html">
|
||||
|
||||
|
||||
Composing Routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.3" data-path="../advanced/different_routers.html">
|
||||
|
||||
<a href="../advanced/different_routers.html">
|
||||
|
||||
|
||||
Different Routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.4" data-path="../advanced/route_validation.html">
|
||||
|
||||
<a href="../advanced/route_validation.html">
|
||||
|
||||
|
||||
Route Validation
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.5" data-path="../advanced/dev_workflow.html">
|
||||
|
||||
<a href="../advanced/dev_workflow.html">
|
||||
|
||||
|
||||
Dev Workflow
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter active" data-level="1.6" data-path="./">
|
||||
|
||||
<a href="./">
|
||||
|
||||
|
||||
Patterns
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.6.1" data-path="shared_routes.html">
|
||||
|
||||
<a href="shared_routes.html">
|
||||
|
||||
|
||||
Shared Routes
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.7" data-path="../frontend/">
|
||||
|
||||
<a href="../frontend/">
|
||||
|
||||
|
||||
Frontend
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.7.1" data-path="../frontend/basics.html">
|
||||
|
||||
<a href="../frontend/basics.html">
|
||||
|
||||
|
||||
Basics
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.7.2" data-path="../frontend/browser.html">
|
||||
|
||||
<a href="../frontend/browser.html">
|
||||
|
||||
|
||||
Browser integration
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.7.3" data-path="../frontend/controllers.html">
|
||||
|
||||
<a href="../frontend/controllers.html">
|
||||
|
||||
|
||||
Controllers (WIP)
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.8" data-path="../performance.html">
|
||||
|
||||
<a href="../performance.html">
|
||||
|
||||
|
||||
Performance
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.9" data-path="../interceptors.html">
|
||||
|
||||
<a href="../interceptors.html">
|
||||
|
||||
|
||||
Interceptors (WIP)
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.10" data-path="../development.html">
|
||||
|
||||
<a href="../development.html">
|
||||
|
||||
|
||||
Development Instructions
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.11" data-path="../faq.html">
|
||||
|
||||
<a href="../faq.html">
|
||||
|
||||
|
||||
FAQ
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
<li>
|
||||
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
|
||||
Published with GitBook
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="book-body">
|
||||
|
||||
<div class="body-inner">
|
||||
|
||||
|
||||
|
||||
<div class="book-header" role="navigation">
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
<i class="fa fa-circle-o-notch fa-spin"></i>
|
||||
<a href=".." >Patterns</a>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="page-wrapper" tabindex="-1" role="main">
|
||||
<div class="page-inner">
|
||||
|
||||
<div id="book-search-results">
|
||||
<div class="search-noresults">
|
||||
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<h1 id="patterns">Patterns</h1>
|
||||
<ul>
|
||||
<li><a href="shared_routes.html">Shared Routes</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
<div class="search-results">
|
||||
<div class="has-results">
|
||||
|
||||
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
|
||||
<ul class="search-results-list"></ul>
|
||||
|
||||
</div>
|
||||
<div class="no-results">
|
||||
|
||||
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<a href="../advanced/dev_workflow.html" class="navigation navigation-prev " aria-label="Previous page: Dev Workflow">
|
||||
<i class="fa fa-angle-left"></i>
|
||||
</a>
|
||||
|
||||
|
||||
<a href="shared_routes.html" class="navigation navigation-next " aria-label="Next page: Shared Routes">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Patterns","level":"1.6","depth":1,"next":{"title":"Shared Routes","level":"1.6.1","depth":2,"path":"patterns/shared_routes.md","ref":"patterns/shared_routes.md","articles":[]},"previous":{"title":"Dev Workflow","level":"1.5.5","depth":2,"path":"advanced/dev_workflow.md","ref":"advanced/dev_workflow.md","articles":[]},"dir":"ltr"},"config":{"plugins":["editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"github":{"url":"https://github.com/metosin/reitit"},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"patterns/README.md","mtime":"2018-09-02T14:52:37.221Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-02T14:53:17.801Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook.js"></script>
|
||||
<script src="../gitbook/theme.js"></script>
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-editlink/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-github/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-search/search.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
@ -1,899 +0,0 @@
|
|||
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="" >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>Shared Routes · GitBook</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="description" content="">
|
||||
<meta name="generator" content="GitBook 3.2.3">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/style.css">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta name="HandheldFriendly" content="true"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
|
||||
<link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
|
||||
|
||||
|
||||
<link rel="next" href="../frontend/" />
|
||||
|
||||
|
||||
<link rel="prev" href="./" />
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="book">
|
||||
<div class="book-summary">
|
||||
|
||||
|
||||
<div id="book-search-input" role="search">
|
||||
<input type="text" placeholder="Type to search" />
|
||||
</div>
|
||||
|
||||
|
||||
<nav role="navigation">
|
||||
|
||||
|
||||
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1" data-path="../">
|
||||
|
||||
<a href="../">
|
||||
|
||||
|
||||
Introduction
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2" data-path="../basics/">
|
||||
|
||||
<a href="../basics/">
|
||||
|
||||
|
||||
Basics
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.2.1" data-path="../basics/route_syntax.html">
|
||||
|
||||
<a href="../basics/route_syntax.html">
|
||||
|
||||
|
||||
Route Syntax
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.2" data-path="../basics/router.html">
|
||||
|
||||
<a href="../basics/router.html">
|
||||
|
||||
|
||||
Router
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.3" data-path="../basics/path_based_routing.html">
|
||||
|
||||
<a href="../basics/path_based_routing.html">
|
||||
|
||||
|
||||
Path-based Routing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.4" data-path="../basics/name_based_routing.html">
|
||||
|
||||
<a href="../basics/name_based_routing.html">
|
||||
|
||||
|
||||
Name-based Routing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.5" data-path="../basics/route_data.html">
|
||||
|
||||
<a href="../basics/route_data.html">
|
||||
|
||||
|
||||
Route Data
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.6" data-path="../basics/route_data_validation.html">
|
||||
|
||||
<a href="../basics/route_data_validation.html">
|
||||
|
||||
|
||||
Route Data Validation
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.7" data-path="../basics/route_conflicts.html">
|
||||
|
||||
<a href="../basics/route_conflicts.html">
|
||||
|
||||
|
||||
Route Conflicts
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3" data-path="../coercion/">
|
||||
|
||||
<a href="../coercion/">
|
||||
|
||||
|
||||
Coercion
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.3.1" data-path="../coercion/coercion.html">
|
||||
|
||||
<a href="../coercion/coercion.html">
|
||||
|
||||
|
||||
Coercion Explained
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.2" data-path="../coercion/schema_coercion.html">
|
||||
|
||||
<a href="../coercion/schema_coercion.html">
|
||||
|
||||
|
||||
Plumatic Schema
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.3" data-path="../coercion/clojure_spec_coercion.html">
|
||||
|
||||
<a href="../coercion/clojure_spec_coercion.html">
|
||||
|
||||
|
||||
Clojure.spec
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.4" data-path="../coercion/data_spec_coercion.html">
|
||||
|
||||
<a href="../coercion/data_spec_coercion.html">
|
||||
|
||||
|
||||
Data-specs
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4" data-path="../ring/">
|
||||
|
||||
<a href="../ring/">
|
||||
|
||||
|
||||
Ring
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.4.1" data-path="../ring/ring.html">
|
||||
|
||||
<a href="../ring/ring.html">
|
||||
|
||||
|
||||
Ring-router
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.2" data-path="../ring/reverse_routing.html">
|
||||
|
||||
<a href="../ring/reverse_routing.html">
|
||||
|
||||
|
||||
Reverse-routing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.3" data-path="../ring/default_handler.html">
|
||||
|
||||
<a href="../ring/default_handler.html">
|
||||
|
||||
|
||||
Default handler
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.4" data-path="../ring/static.html">
|
||||
|
||||
<a href="../ring/static.html">
|
||||
|
||||
|
||||
Static Resources
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.5" data-path="../ring/dynamic_extensions.html">
|
||||
|
||||
<a href="../ring/dynamic_extensions.html">
|
||||
|
||||
|
||||
Dynamic Extensions
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.6" data-path="../ring/data_driven_middleware.html">
|
||||
|
||||
<a href="../ring/data_driven_middleware.html">
|
||||
|
||||
|
||||
Data-driven Middleware
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.7" data-path="../ring/transforming_middleware_chain.html">
|
||||
|
||||
<a href="../ring/transforming_middleware_chain.html">
|
||||
|
||||
|
||||
Transforming Middleware Chain
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.8" data-path="../ring/middleware_registry.html">
|
||||
|
||||
<a href="../ring/middleware_registry.html">
|
||||
|
||||
|
||||
Middleware Registry
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.9" data-path="../ring/default_middleware.html">
|
||||
|
||||
<a href="../ring/default_middleware.html">
|
||||
|
||||
|
||||
Default Middleware
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.10" data-path="../ring/coercion.html">
|
||||
|
||||
<a href="../ring/coercion.html">
|
||||
|
||||
|
||||
Pluggable Coercion
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.11" data-path="../ring/route_data_validation.html">
|
||||
|
||||
<a href="../ring/route_data_validation.html">
|
||||
|
||||
|
||||
Route Data Validation
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.12" data-path="../ring/compiling_middleware.html">
|
||||
|
||||
<a href="../ring/compiling_middleware.html">
|
||||
|
||||
|
||||
Compiling Middleware
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.13" data-path="../ring/swagger.html">
|
||||
|
||||
<a href="../ring/swagger.html">
|
||||
|
||||
|
||||
Swagger Support
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5" data-path="../advanced/">
|
||||
|
||||
<a href="../advanced/">
|
||||
|
||||
|
||||
Advanced
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.5.1" data-path="../advanced/configuring_routers.html">
|
||||
|
||||
<a href="../advanced/configuring_routers.html">
|
||||
|
||||
|
||||
Configuring Routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.2" data-path="../advanced/composing_routers.html">
|
||||
|
||||
<a href="../advanced/composing_routers.html">
|
||||
|
||||
|
||||
Composing Routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.3" data-path="../advanced/different_routers.html">
|
||||
|
||||
<a href="../advanced/different_routers.html">
|
||||
|
||||
|
||||
Different Routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.4" data-path="../advanced/route_validation.html">
|
||||
|
||||
<a href="../advanced/route_validation.html">
|
||||
|
||||
|
||||
Route Validation
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.5" data-path="../advanced/dev_workflow.html">
|
||||
|
||||
<a href="../advanced/dev_workflow.html">
|
||||
|
||||
|
||||
Dev Workflow
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.6" data-path="./">
|
||||
|
||||
<a href="./">
|
||||
|
||||
|
||||
Patterns
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter active" data-level="1.6.1" data-path="shared_routes.html">
|
||||
|
||||
<a href="shared_routes.html">
|
||||
|
||||
|
||||
Shared Routes
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.7" data-path="../frontend/">
|
||||
|
||||
<a href="../frontend/">
|
||||
|
||||
|
||||
Frontend
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.7.1" data-path="../frontend/basics.html">
|
||||
|
||||
<a href="../frontend/basics.html">
|
||||
|
||||
|
||||
Basics
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.7.2" data-path="../frontend/browser.html">
|
||||
|
||||
<a href="../frontend/browser.html">
|
||||
|
||||
|
||||
Browser integration
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.7.3" data-path="../frontend/controllers.html">
|
||||
|
||||
<a href="../frontend/controllers.html">
|
||||
|
||||
|
||||
Controllers (WIP)
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.8" data-path="../performance.html">
|
||||
|
||||
<a href="../performance.html">
|
||||
|
||||
|
||||
Performance
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.9" data-path="../interceptors.html">
|
||||
|
||||
<a href="../interceptors.html">
|
||||
|
||||
|
||||
Interceptors (WIP)
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.10" data-path="../development.html">
|
||||
|
||||
<a href="../development.html">
|
||||
|
||||
|
||||
Development Instructions
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.11" data-path="../faq.html">
|
||||
|
||||
<a href="../faq.html">
|
||||
|
||||
|
||||
FAQ
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
<li>
|
||||
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
|
||||
Published with GitBook
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="book-body">
|
||||
|
||||
<div class="body-inner">
|
||||
|
||||
|
||||
|
||||
<div class="book-header" role="navigation">
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
<i class="fa fa-circle-o-notch fa-spin"></i>
|
||||
<a href=".." >Shared Routes</a>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="page-wrapper" tabindex="-1" role="main">
|
||||
<div class="page-inner">
|
||||
|
||||
<div id="book-search-results">
|
||||
<div class="search-noresults">
|
||||
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<h1 id="shared-routes">Shared routes</h1>
|
||||
<p>As <code>reitit-core</code> works with both Clojure & ClojureScript, one can have a shared routing table for both the frontend and the backend application, using the <a href="https://clojure.org/guides/reader_conditionals" target="_blank">Clujore Common Files</a>.</p>
|
||||
<p>For backend, you need to define a <code>:handler</code> for the request processing, for fronend, <code>:name</code> enables the use of <a href="../basics/name_based_routing.html">reverse routing</a>.</p>
|
||||
<p>There are multiple options to use shared routing table.</p>
|
||||
<h2 id="using-reader-conditionals">Using reader conditionals</h2>
|
||||
<pre><code class="lang-clj">;; define the handlers for for clojure
|
||||
#?(:clj (declare get-kikka))
|
||||
#?(:clj (declare post-kikka))
|
||||
|
||||
;; :name for both, :handler just for clojure
|
||||
(def routes
|
||||
["/kikka"
|
||||
{:name ::kikka
|
||||
:get #?(:clj {:handler get-kikka})
|
||||
:post #?(:clj {:handler post-kikka})}]
|
||||
</code></pre>
|
||||
<h2 id="using-custom-expander">Using custom expander</h2>
|
||||
<p>raw-routes can have any non-sequential data as a route argument, which gets expanded using the <code>:expand</code> option given to the <code>reitit.core.router</code> function. It defaults to <code>reitit.core/expand</code> multimethod.</p>
|
||||
<p>First, define the common routes (in a <code>.cljc</code> file):</p>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name"><span class="hljs-builtin-name">def</span></span> routes
|
||||
[[<span class="hljs-string">"/kikka"</span> <span class="hljs-symbol">::kikka</span>]
|
||||
[<span class="hljs-string">"/bar"</span> <span class="hljs-symbol">::bar</span>]])
|
||||
</code></pre>
|
||||
<p>Those can be used as-is from ClojureScript:</p>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name">require</span> '[reitit.core <span class="hljs-symbol">:as</span> r])
|
||||
|
||||
(<span class="hljs-name"><span class="hljs-builtin-name">def</span></span> router
|
||||
(<span class="hljs-name">r/router</span> routes))
|
||||
|
||||
(<span class="hljs-name">r/match-by-name</span> router <span class="hljs-symbol">::kikka</span>)
|
||||
<span class="hljs-comment">;#Match{:template "/kikka"</span>
|
||||
<span class="hljs-comment">; :data {:name :user/kikka}</span>
|
||||
<span class="hljs-comment">; :result nil</span>
|
||||
<span class="hljs-comment">; :path-params nil</span>
|
||||
<span class="hljs-comment">; :path "/kikka"}</span>
|
||||
</code></pre>
|
||||
<p>For the backend, we can use a custom-expander to expand the routes:</p>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name">require</span> '[reitit.ring <span class="hljs-symbol">:as</span> ring])
|
||||
|
||||
(<span class="hljs-name"><span class="hljs-builtin-name">defn</span></span> my-expand [registry]
|
||||
(<span class="hljs-name"><span class="hljs-builtin-name">fn</span></span> [data opts]
|
||||
(<span class="hljs-name"><span class="hljs-builtin-name">or</span></span> (<span class="hljs-name"><span class="hljs-builtin-name">if</span></span> (<span class="hljs-name"><span class="hljs-builtin-name">keyword?</span></span> data)
|
||||
(<span class="hljs-name">some-></span> data
|
||||
registry
|
||||
(<span class="hljs-name">r/expand</span> opts)
|
||||
(<span class="hljs-name"><span class="hljs-builtin-name">assoc</span></span> <span class="hljs-symbol">:name</span> data)))
|
||||
(<span class="hljs-name">r/expand</span> data opts))))
|
||||
|
||||
<span class="hljs-comment">;; the handler functions</span>
|
||||
(<span class="hljs-name"><span class="hljs-builtin-name">defn</span></span> get-kikka [_] {<span class="hljs-symbol">:status</span> <span class="hljs-number">200</span>, <span class="hljs-symbol">:body</span> <span class="hljs-string">"get"</span>})
|
||||
(<span class="hljs-name"><span class="hljs-builtin-name">defn</span></span> post-kikka [_] {<span class="hljs-symbol">:status</span> <span class="hljs-number">200</span>, <span class="hljs-symbol">:body</span> <span class="hljs-string">"post"</span>})
|
||||
(<span class="hljs-name"><span class="hljs-builtin-name">defn</span></span> bar [_] {<span class="hljs-symbol">:status</span> <span class="hljs-number">200</span>, <span class="hljs-symbol">:body</span> <span class="hljs-string">"bar"</span>})
|
||||
|
||||
(<span class="hljs-name"><span class="hljs-builtin-name">def</span></span> app
|
||||
(<span class="hljs-name">ring/ring-handler</span>
|
||||
(<span class="hljs-name">ring/router</span>
|
||||
[[<span class="hljs-string">"/kikka"</span> <span class="hljs-symbol">::kikka</span>]
|
||||
[<span class="hljs-string">"/bar"</span> <span class="hljs-symbol">::bar</span>]]
|
||||
<span class="hljs-comment">;; use a custom expander</span>
|
||||
{<span class="hljs-symbol">:expand</span> (<span class="hljs-name">my-expand</span>
|
||||
{<span class="hljs-symbol">::kikka</span> {<span class="hljs-symbol">:get</span> get-kikka
|
||||
<span class="hljs-symbol">:post</span> post-kikka}
|
||||
<span class="hljs-symbol">::bar</span> bar})})))
|
||||
|
||||
(<span class="hljs-name">app</span> {<span class="hljs-symbol">:request-method</span> <span class="hljs-symbol">:post</span>, <span class="hljs-symbol">:uri</span> <span class="hljs-string">"/kikka"</span>})
|
||||
<span class="hljs-comment">; {:status 200, :body "post"}</span>
|
||||
</code></pre>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
<div class="search-results">
|
||||
<div class="has-results">
|
||||
|
||||
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
|
||||
<ul class="search-results-list"></ul>
|
||||
|
||||
</div>
|
||||
<div class="no-results">
|
||||
|
||||
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<a href="./" class="navigation navigation-prev " aria-label="Previous page: Patterns">
|
||||
<i class="fa fa-angle-left"></i>
|
||||
</a>
|
||||
|
||||
|
||||
<a href="../frontend/" class="navigation navigation-next " aria-label="Next page: Frontend">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Shared Routes","level":"1.6.1","depth":2,"next":{"title":"Frontend","level":"1.7","depth":1,"path":"frontend/README.md","ref":"frontend/README.md","articles":[{"title":"Basics","level":"1.7.1","depth":2,"path":"frontend/basics.md","ref":"frontend/basics.md","articles":[]},{"title":"Browser integration","level":"1.7.2","depth":2,"path":"frontend/browser.md","ref":"frontend/browser.md","articles":[]},{"title":"Controllers (WIP)","level":"1.7.3","depth":2,"path":"frontend/controllers.md","ref":"frontend/controllers.md","articles":[]}]},"previous":{"title":"Patterns","level":"1.6","depth":1,"path":"patterns/README.md","ref":"patterns/README.md","articles":[{"title":"Shared Routes","level":"1.6.1","depth":2,"path":"patterns/shared_routes.md","ref":"patterns/shared_routes.md","articles":[]}]},"dir":"ltr"},"config":{"plugins":["editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"github":{"url":"https://github.com/metosin/reitit"},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"patterns/shared_routes.md","mtime":"2018-09-02T14:52:37.221Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-02T14:53:17.801Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook.js"></script>
|
||||
<script src="../gitbook/theme.js"></script>
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-editlink/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-github/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-search/search.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
@ -955,7 +955,7 @@
|
|||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Performance","level":"8.1","depth":1,"next":{"title":"Development Instructions","level":"8.2","depth":1,"path":"development.md","ref":"development.md","articles":[]},"previous":{"title":"Shared Routes","level":"7.6","depth":1,"path":"advanced/shared_routes.md","ref":"advanced/shared_routes.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"performance.md","mtime":"2020-04-01T08:59:17.508Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-24T11:08:28.724Z"},"basePath":".","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Performance","level":"8.1","depth":1,"next":{"title":"Development Instructions","level":"8.2","depth":1,"path":"development.md","ref":"development.md","articles":[]},"previous":{"title":"Shared Routes","level":"7.6","depth":1,"path":"advanced/shared_routes.md","ref":"advanced/shared_routes.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"performance.md","mtime":"2020-04-01T08:59:17.508Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-28T09:52:25.779Z"},"basePath":".","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
|
|
|||
568
ring.html
568
ring.html
|
|
@ -1,568 +0,0 @@
|
|||
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="" >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>Ring-router · GitBook</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="description" content="">
|
||||
<meta name="generator" content="GitBook 3.2.3">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="gitbook/style.css">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="gitbook/gitbook-plugin-highlight/website.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="gitbook/gitbook-plugin-search/search.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta name="HandheldFriendly" content="true"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
|
||||
<link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">
|
||||
|
||||
|
||||
<link rel="next" href="dynamic_extensions.html" />
|
||||
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="book">
|
||||
<div class="book-summary">
|
||||
|
||||
|
||||
<div id="book-search-input" role="search">
|
||||
<input type="text" placeholder="Type to search" />
|
||||
</div>
|
||||
|
||||
|
||||
<nav role="navigation">
|
||||
|
||||
|
||||
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1" data-path="./">
|
||||
|
||||
<a href="./">
|
||||
|
||||
|
||||
Introduction
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
Basics
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.2.1" data-path="basics.html">
|
||||
|
||||
<a href="basics.html#route-syntax">
|
||||
|
||||
|
||||
Route syntax
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.2" data-path="basics.html">
|
||||
|
||||
<a href="basics.html#router">
|
||||
|
||||
|
||||
Router
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.3" data-path="basics.html">
|
||||
|
||||
<a href="basics.html#path-based-routing">
|
||||
|
||||
|
||||
Path-based Routing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.4" data-path="basics.html">
|
||||
|
||||
<a href="basics.html#name-based-routing">
|
||||
|
||||
|
||||
Name-based Routing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.5" data-path="basics.html">
|
||||
|
||||
<a href="basics.html#route-data">
|
||||
|
||||
|
||||
Route data
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.6" data-path="basics.html">
|
||||
|
||||
<a href="basics.html#different-routers">
|
||||
|
||||
|
||||
Different Routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
Advanced
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.3.1" data-path="route_conflicts.html">
|
||||
|
||||
<a href="route_conflicts.html">
|
||||
|
||||
|
||||
Route conflicts
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.2" data-path="route_validation.html">
|
||||
|
||||
<a href="route_validation.html">
|
||||
|
||||
|
||||
Route Validation
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.3" data-path="configuring_routers.html">
|
||||
|
||||
<a href="configuring_routers.html">
|
||||
|
||||
|
||||
Configuring routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
Ring
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter active" data-level="1.4.1" data-path="ring.html">
|
||||
|
||||
<a href="ring.html">
|
||||
|
||||
|
||||
Ring-router
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.2" data-path="dynamic_extensions.html">
|
||||
|
||||
<a href="dynamic_extensions.html">
|
||||
|
||||
|
||||
Dynamic extensions
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.3" data-path="parameter_coercion.html">
|
||||
|
||||
<a href="parameter_coercion.html">
|
||||
|
||||
|
||||
Parameter coercion
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.4" data-path="compiling_middleware.html">
|
||||
|
||||
<a href="compiling_middleware.html">
|
||||
|
||||
|
||||
Compiling middleware
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
TODO: Swagger & OpenAPI
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.6" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
TODO: Interceptors
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
<li>
|
||||
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
|
||||
Published with GitBook
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="book-body">
|
||||
|
||||
<div class="body-inner">
|
||||
|
||||
|
||||
|
||||
<div class="book-header" role="navigation">
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
<i class="fa fa-circle-o-notch fa-spin"></i>
|
||||
<a href="." >Ring-router</a>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="page-wrapper" tabindex="-1" role="main">
|
||||
<div class="page-inner">
|
||||
|
||||
<div id="book-search-results">
|
||||
<div class="search-noresults">
|
||||
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<h1 id="ring-router">Ring Router</h1>
|
||||
<p><a href="https://github.com/ring-clojure/ring" target="_blank">Ring</a>-router adds support for <a href="https://github.com/ring-clojure/ring/wiki/Concepts#handlers" target="_blank">handlers</a>, <a href="https://github.com/ring-clojure/ring/wiki/Concepts#middleware" target="_blank">middleware</a> and routing based on <code>:request-method</code>. Ring-router is created with <code>reitit.ring/router</code> function. It runs a custom route compiler, creating a optimized stucture for handling route matches, with compiled middleware chain & handlers for all request methods. It also ensures that all routes have a <code>:handler</code> defined.</p>
|
||||
<p>Simple Ring app:</p>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name">require</span> '[reitit.ring <span class="hljs-symbol">:as</span> ring])
|
||||
|
||||
(<span class="hljs-name"><span class="hljs-builtin-name">defn</span></span> handler [_]
|
||||
{<span class="hljs-symbol">:status</span> <span class="hljs-number">200</span>, <span class="hljs-symbol">:body</span> <span class="hljs-string">"ok"</span>})
|
||||
|
||||
(<span class="hljs-name"><span class="hljs-builtin-name">def</span></span> app
|
||||
(<span class="hljs-name">ring/ring-handler</span>
|
||||
(<span class="hljs-name">ring/router</span>
|
||||
[<span class="hljs-string">"/ping"</span> handler])))
|
||||
</code></pre>
|
||||
<p>Applying the handler:</p>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name">app</span> {<span class="hljs-symbol">:request-method</span> <span class="hljs-symbol">:get</span>, <span class="hljs-symbol">:uri</span> <span class="hljs-string">"/favicon.ico"</span>})
|
||||
<span class="hljs-comment">; nil</span>
|
||||
|
||||
(<span class="hljs-name">app</span> {<span class="hljs-symbol">:request-method</span> <span class="hljs-symbol">:get</span>, <span class="hljs-symbol">:uri</span> <span class="hljs-string">"/ping"</span>})
|
||||
<span class="hljs-comment">; {:status 200, :body "ok"}</span>
|
||||
</code></pre>
|
||||
<p>The expanded routes:</p>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name"><span class="hljs-builtin-name">-></span></span> app (<span class="hljs-name">ring/get-router</span>) (<span class="hljs-name">reitit/routes</span>))
|
||||
<span class="hljs-comment">; [["/ping"</span>
|
||||
<span class="hljs-comment">; {:handler #object[...]}</span>
|
||||
<span class="hljs-comment">; #Methods{:any #Endpoint{:meta {:handler #object[...]},</span>
|
||||
<span class="hljs-comment">; :handler #object[...],</span>
|
||||
<span class="hljs-comment">; :middleware []}}]]</span>
|
||||
</code></pre>
|
||||
<p>Note that the compiled resuts as third element in the route vector.</p>
|
||||
<h1 id="request-method-based-routing">Request-method based routing</h1>
|
||||
<p>Handler are also looked under request-method keys: <code>:get</code>, <code>:head</code>, <code>:patch</code>, <code>:delete</code>, <code>:options</code>, <code>:post</code> or <code>:put</code>. Top-level handler is used if request-method based handler is not found.</p>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name"><span class="hljs-builtin-name">def</span></span> app
|
||||
(<span class="hljs-name">ring/ring-handler</span>
|
||||
(<span class="hljs-name">ring/router</span>
|
||||
[<span class="hljs-string">"/ping"</span> {<span class="hljs-symbol">:name</span> <span class="hljs-symbol">::ping</span>
|
||||
<span class="hljs-symbol">:get</span> handler
|
||||
<span class="hljs-symbol">:post</span> handler}])))
|
||||
|
||||
(<span class="hljs-name">app</span> {<span class="hljs-symbol">:request-method</span> <span class="hljs-symbol">:get</span>, <span class="hljs-symbol">:uri</span> <span class="hljs-string">"/ping"</span>})
|
||||
<span class="hljs-comment">; {:status 200, :body "ok"}</span>
|
||||
|
||||
(<span class="hljs-name">app</span> {<span class="hljs-symbol">:request-method</span> <span class="hljs-symbol">:put</span>, <span class="hljs-symbol">:uri</span> <span class="hljs-string">"/ping"</span>})
|
||||
<span class="hljs-comment">; nil</span>
|
||||
</code></pre>
|
||||
<p>Reverse routing:</p>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name"><span class="hljs-builtin-name">-></span></span> app
|
||||
(<span class="hljs-name">ring/get-router</span>)
|
||||
(<span class="hljs-name">reitit/match-by-name</span> <span class="hljs-symbol">::ping</span>)
|
||||
<span class="hljs-symbol">:path</span>)
|
||||
<span class="hljs-comment">; "/ping"</span>
|
||||
</code></pre>
|
||||
<h1 id="middleware">Middleware</h1>
|
||||
<p>Middleware can be added with a <code>:middleware</code> key, with a vector value of the following:</p>
|
||||
<ol>
|
||||
<li>ring middleware function <code>handler -> request -> response</code></li>
|
||||
<li>vector of middleware function <code>handler ?args -> request -> response</code> and optinally it's args.</li>
|
||||
</ol>
|
||||
<p>A middleware and a handler:</p>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name"><span class="hljs-builtin-name">defn</span></span> wrap [handler id]
|
||||
(<span class="hljs-name"><span class="hljs-builtin-name">fn</span></span> [request]
|
||||
(<span class="hljs-name">handler</span> (<span class="hljs-name">update</span> request <span class="hljs-symbol">::acc</span> (<span class="hljs-name">fnil</span> conj []) id))))
|
||||
|
||||
(<span class="hljs-name"><span class="hljs-builtin-name">defn</span></span> handler [{<span class="hljs-symbol">:keys</span> [<span class="hljs-symbol">::acc</span>]}]
|
||||
{<span class="hljs-symbol">:status</span> <span class="hljs-number">200</span>, <span class="hljs-symbol">:body</span> (<span class="hljs-name"><span class="hljs-builtin-name">conj</span></span> acc <span class="hljs-symbol">:handler</span>)})
|
||||
</code></pre>
|
||||
<p>App with nested middleware:</p>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name"><span class="hljs-builtin-name">def</span></span> app
|
||||
(<span class="hljs-name">ring/ring-handler</span>
|
||||
(<span class="hljs-name">ring/router</span>
|
||||
[<span class="hljs-string">"/api"</span> {<span class="hljs-symbol">:middleware</span> [#(<span class="hljs-name">wrap</span> % <span class="hljs-symbol">:api</span>)]}
|
||||
[<span class="hljs-string">"/ping"</span> handler]
|
||||
[<span class="hljs-string">"/admin"</span> {<span class="hljs-symbol">:middleware</span> [[wrap <span class="hljs-symbol">:admin</span>]]}
|
||||
[<span class="hljs-string">"/db"</span> {<span class="hljs-symbol">:middleware</span> [[wrap <span class="hljs-symbol">:db</span>]]
|
||||
<span class="hljs-symbol">:delete</span> {<span class="hljs-symbol">:middleware</span> [#(<span class="hljs-name">wrap</span> % <span class="hljs-symbol">:delete</span>)]
|
||||
<span class="hljs-symbol">:handler</span> handler}}]]])))
|
||||
</code></pre>
|
||||
<p>Middleware is applied correctly:</p>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name">app</span> {<span class="hljs-symbol">:request-method</span> <span class="hljs-symbol">:delete</span>, <span class="hljs-symbol">:uri</span> <span class="hljs-string">"/api/ping"</span>})
|
||||
<span class="hljs-comment">; {:status 200, :body [:api :handler]}</span>
|
||||
</code></pre>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name">app</span> {<span class="hljs-symbol">:request-method</span> <span class="hljs-symbol">:delete</span>, <span class="hljs-symbol">:uri</span> <span class="hljs-string">"/api/admin/db"</span>})
|
||||
<span class="hljs-comment">; {:status 200, :body [:api :admin :db :delete :handler]}</span>
|
||||
</code></pre>
|
||||
<h1 id="async-ring">Async Ring</h1>
|
||||
<p>All built-in middleware provide both 2 and 3-arity and are compiled for both Clojure & ClojureScript, so they work with <a href="https://www.booleanknot.com/blog/2016/07/15/asynchronous-ring.html" target="_blank">Async Ring</a> and <a href="https://nodejs.org" target="_blank">Node.js</a> too.</p>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
<div class="search-results">
|
||||
<div class="has-results">
|
||||
|
||||
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
|
||||
<ul class="search-results-list"></ul>
|
||||
|
||||
</div>
|
||||
<div class="no-results">
|
||||
|
||||
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<a href="dynamic_extensions.html" class="navigation navigation-next navigation-unique" aria-label="Next page: Dynamic extensions">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Ring-router","level":"1.4.1","depth":2,"next":{"title":"Dynamic extensions","level":"1.4.2","depth":2,"path":"dynamic_extensions.md","ref":"dynamic_extensions.md","articles":[]},"previous":{"title":"Ring","level":"1.4","depth":1,"ref":"","articles":[{"title":"Ring-router","level":"1.4.1","depth":2,"path":"ring.md","ref":"ring.md","articles":[]},{"title":"Dynamic extensions","level":"1.4.2","depth":2,"path":"dynamic_extensions.md","ref":"dynamic_extensions.md","articles":[]},{"title":"Parameter coercion","level":"1.4.3","depth":2,"path":"parameter_coercion.md","ref":"parameter_coercion.md","articles":[]},{"title":"Compiling middleware","level":"1.4.4","depth":2,"path":"compiling_middleware.md","ref":"compiling_middleware.md","articles":[]}]},"dir":"ltr"},"config":{"plugins":["editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"github":{"url":"https://github.com/metosin/reitit"},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"ring.md","mtime":"2017-10-25T15:00:22.836Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2017-10-25T15:01:14.084Z"},"basePath":".","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
|
||||
<script src="gitbook/gitbook.js"></script>
|
||||
<script src="gitbook/theme.js"></script>
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-editlink/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-github/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-search/search-engine.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-search/search.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-sharing/buttons.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
@ -873,7 +873,7 @@ This is so that our middleware is applied before reitit matches the request with
|
|||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"RESTful form methods","level":"4.17","depth":1,"next":{"title":"Interceptors","level":"5.1","depth":1,"path":"http/interceptors.md","ref":"http/interceptors.md","articles":[]},"previous":{"title":"Swagger Support","level":"4.16","depth":1,"path":"ring/swagger.md","ref":"ring/swagger.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"ring/RESTful_form_methods.md","mtime":"2020-01-14T13:47:50.988Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-24T11:08:28.724Z"},"basePath":"..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"RESTful form methods","level":"4.17","depth":1,"next":{"title":"Interceptors","level":"5.1","depth":1,"path":"http/interceptors.md","ref":"http/interceptors.md","articles":[]},"previous":{"title":"Swagger Support","level":"4.16","depth":1,"path":"ring/swagger.md","ref":"ring/swagger.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"ring/RESTful_form_methods.md","mtime":"2020-01-14T13:47:50.988Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-28T09:52:25.779Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,36 +0,0 @@
|
|||
# RESTful form methods
|
||||
|
||||
When designing RESTful applications you will be doing a lot of "PATCH" and "DELETE" request, but most browsers don't support methods other than "GET" and "POST" when it comes to submitting forms.
|
||||
|
||||
There is a pattern to solve this (pioneered by Rails) using a hidden "_method" field in the form and swapping out the "POST" method for whatever is in that field.
|
||||
|
||||
We can do this with middleware in reitit like this:
|
||||
```clj
|
||||
(defn- hidden-method
|
||||
[request]
|
||||
(keyword
|
||||
(or (get-in request [:form-params "_method"]) ;; look for "_method" field in :form-params
|
||||
(get-in request [:multipart-params "_method"])))) ;; or in :multipart-params
|
||||
|
||||
(def wrap-hidden-method
|
||||
{:name ::wrap-hidden-method
|
||||
:wrap (fn [handler]
|
||||
(fn [request]
|
||||
(if-let [fm (and (= :post (:request-method request)) ;; if this is a :post request
|
||||
(hidden-method request))] ;; and there is a "_method" field
|
||||
(handler (assoc request :request-method fm)) ;; replace :request-method
|
||||
(handler request))))})
|
||||
```
|
||||
|
||||
And apply the middleware like this:
|
||||
```clj
|
||||
(reitit.ring/ring-handler
|
||||
(reitit.ring/router ...)
|
||||
(reitit.ring/create-default-handler)
|
||||
{:middleware
|
||||
[reitit.ring.middleware.parameters/parameters-middleware ;; needed to have :form-params in the request map
|
||||
reitit.ring.middleware.multipart/multipart-middleware ;; needed to have :multipart-params in the request map
|
||||
wrap-hidden-method]}) ;; our hidden method wrapper
|
||||
```
|
||||
(NOTE: This middleware must be placed here and not inside the route data given to `reitit.ring/handler`.
|
||||
This is so that our middleware is applied before reitit matches the request with a spesific handler using the wrong method.)
|
||||
|
|
@ -1074,7 +1074,7 @@
|
|||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Pluggable Coercion","level":"4.13","depth":1,"next":{"title":"Route Data Validation","level":"4.14","depth":1,"path":"ring/route_data_validation.md","ref":"ring/route_data_validation.md","articles":[]},"previous":{"title":"Content Negotiation","level":"4.12","depth":1,"path":"ring/content_negotiation.md","ref":"ring/content_negotiation.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"ring/coercion.md","mtime":"2020-01-14T13:47:50.988Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-24T11:08:28.724Z"},"basePath":"..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Pluggable Coercion","level":"4.13","depth":1,"next":{"title":"Route Data Validation","level":"4.14","depth":1,"path":"ring/route_data_validation.md","ref":"ring/route_data_validation.md","articles":[]},"previous":{"title":"Content Negotiation","level":"4.12","depth":1,"path":"ring/content_negotiation.md","ref":"ring/content_negotiation.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"ring/coercion.md","mtime":"2020-01-14T13:47:50.988Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-28T09:52:25.779Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -936,7 +936,7 @@
|
|||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Compiling Middleware","level":"4.15","depth":1,"next":{"title":"Swagger Support","level":"4.16","depth":1,"path":"ring/swagger.md","ref":"ring/swagger.md","articles":[]},"previous":{"title":"Route Data Validation","level":"4.14","depth":1,"path":"ring/route_data_validation.md","ref":"ring/route_data_validation.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"ring/compiling_middleware.md","mtime":"2020-01-14T13:47:50.989Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-24T11:08:28.724Z"},"basePath":"..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Compiling Middleware","level":"4.15","depth":1,"next":{"title":"Swagger Support","level":"4.16","depth":1,"path":"ring/swagger.md","ref":"ring/swagger.md","articles":[]},"previous":{"title":"Route Data Validation","level":"4.14","depth":1,"path":"ring/route_data_validation.md","ref":"ring/route_data_validation.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"ring/compiling_middleware.md","mtime":"2020-01-14T13:47:50.989Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-28T09:52:25.779Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -959,7 +959,7 @@ Server: Jetty(9.2.21.v20170120)
|
|||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Content Negotiation","level":"4.12","depth":1,"next":{"title":"Pluggable Coercion","level":"4.13","depth":1,"path":"ring/coercion.md","ref":"ring/coercion.md","articles":[]},"previous":{"title":"Default Middleware","level":"4.11","depth":1,"path":"ring/default_middleware.md","ref":"ring/default_middleware.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"ring/content_negotiation.md","mtime":"2020-04-01T08:59:17.508Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-24T11:08:28.724Z"},"basePath":"..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Content Negotiation","level":"4.12","depth":1,"next":{"title":"Pluggable Coercion","level":"4.13","depth":1,"path":"ring/coercion.md","ref":"ring/coercion.md","articles":[]},"previous":{"title":"Default Middleware","level":"4.11","depth":1,"path":"ring/default_middleware.md","ref":"ring/default_middleware.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"ring/content_negotiation.md","mtime":"2020-04-01T08:59:17.508Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-28T09:52:25.779Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -934,7 +934,7 @@
|
|||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Data-driven Middleware","level":"4.7","depth":1,"next":{"title":"Transforming Middleware Chain","level":"4.8","depth":1,"path":"ring/transforming_middleware_chain.md","ref":"ring/transforming_middleware_chain.md","articles":[]},"previous":{"title":"Dynamic Extensions","level":"4.6","depth":1,"path":"ring/dynamic_extensions.md","ref":"ring/dynamic_extensions.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"ring/data_driven_middleware.md","mtime":"2020-01-14T13:47:50.990Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-24T11:08:28.724Z"},"basePath":"..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Data-driven Middleware","level":"4.7","depth":1,"next":{"title":"Transforming Middleware Chain","level":"4.8","depth":1,"path":"ring/transforming_middleware_chain.md","ref":"ring/transforming_middleware_chain.md","articles":[]},"previous":{"title":"Dynamic Extensions","level":"4.6","depth":1,"path":"ring/dynamic_extensions.md","ref":"ring/dynamic_extensions.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"ring/data_driven_middleware.md","mtime":"2020-01-14T13:47:50.990Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-28T09:52:25.779Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -912,7 +912,7 @@
|
|||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Default handler","level":"4.3","depth":1,"next":{"title":"Slash handler","level":"4.4","depth":1,"path":"ring/slash_handler.md","ref":"ring/slash_handler.md","articles":[]},"previous":{"title":"Reverse-routing","level":"4.2","depth":1,"path":"ring/reverse_routing.md","ref":"ring/reverse_routing.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"ring/default_handler.md","mtime":"2020-01-14T13:47:50.991Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-24T11:08:28.724Z"},"basePath":"..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Default handler","level":"4.3","depth":1,"next":{"title":"Slash handler","level":"4.4","depth":1,"path":"ring/slash_handler.md","ref":"ring/slash_handler.md","articles":[]},"previous":{"title":"Reverse-routing","level":"4.2","depth":1,"path":"ring/reverse_routing.md","ref":"ring/reverse_routing.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"ring/default_handler.md","mtime":"2020-01-14T13:47:50.991Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-28T09:52:25.779Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -893,7 +893,7 @@
|
|||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Default Middleware","level":"4.11","depth":1,"next":{"title":"Content Negotiation","level":"4.12","depth":1,"path":"ring/content_negotiation.md","ref":"ring/content_negotiation.md","articles":[]},"previous":{"title":"Exception Handling with Ring","level":"4.10","depth":1,"path":"ring/exceptions.md","ref":"ring/exceptions.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"ring/default_middleware.md","mtime":"2020-07-24T09:34:09.877Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-24T11:08:28.724Z"},"basePath":"..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Default Middleware","level":"4.11","depth":1,"next":{"title":"Content Negotiation","level":"4.12","depth":1,"path":"ring/content_negotiation.md","ref":"ring/content_negotiation.md","articles":[]},"previous":{"title":"Exception Handling with Ring","level":"4.10","depth":1,"path":"ring/exceptions.md","ref":"ring/exceptions.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"ring/default_middleware.md","mtime":"2020-07-24T09:34:09.877Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-28T09:52:25.779Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -881,7 +881,7 @@
|
|||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Dynamic Extensions","level":"4.6","depth":1,"next":{"title":"Data-driven Middleware","level":"4.7","depth":1,"path":"ring/data_driven_middleware.md","ref":"ring/data_driven_middleware.md","articles":[]},"previous":{"title":"Static Resources","level":"4.5","depth":1,"path":"ring/static.md","ref":"ring/static.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"ring/dynamic_extensions.md","mtime":"2020-04-01T08:59:17.509Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-24T11:08:28.724Z"},"basePath":"..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Dynamic Extensions","level":"4.6","depth":1,"next":{"title":"Data-driven Middleware","level":"4.7","depth":1,"path":"ring/data_driven_middleware.md","ref":"ring/data_driven_middleware.md","articles":[]},"previous":{"title":"Static Resources","level":"4.5","depth":1,"path":"ring/static.md","ref":"ring/static.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"ring/dynamic_extensions.md","mtime":"2020-04-01T08:59:17.509Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-28T09:52:25.779Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -960,7 +960,7 @@
|
|||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Exception Handling with Ring","level":"4.10","depth":1,"next":{"title":"Default Middleware","level":"4.11","depth":1,"path":"ring/default_middleware.md","ref":"ring/default_middleware.md","articles":[]},"previous":{"title":"Middleware Registry","level":"4.9","depth":1,"path":"ring/middleware_registry.md","ref":"ring/middleware_registry.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"ring/exceptions.md","mtime":"2020-07-24T09:34:09.877Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-24T11:08:28.724Z"},"basePath":"..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Exception Handling with Ring","level":"4.10","depth":1,"next":{"title":"Default Middleware","level":"4.11","depth":1,"path":"ring/default_middleware.md","ref":"ring/default_middleware.md","articles":[]},"previous":{"title":"Middleware Registry","level":"4.9","depth":1,"path":"ring/middleware_registry.md","ref":"ring/middleware_registry.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"ring/exceptions.md","mtime":"2020-07-24T09:34:09.877Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-28T09:52:25.779Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,107 +0,0 @@
|
|||
# Exception Handling with Ring
|
||||
|
||||
```clj
|
||||
[metosin/reitit-middleware "0.4.2"]
|
||||
```
|
||||
|
||||
Exceptions thrown in router creation can be [handled with custom exception handler](../basics/error_messages.md). By default, exceptions thrown at runtime from a handler or a middleware are not caught by the `reitit.ring/ring-handler`. A good practise is a have an top-level exception handler to log and format the errors for clients.
|
||||
|
||||
```clj
|
||||
(require '[reitit.ring.middleware.exception :as exception])
|
||||
```
|
||||
|
||||
### `exception/exception-middleware`
|
||||
|
||||
A preconfigured middleware using `exception/default-handlers`. Catches:
|
||||
|
||||
* Request & response [Coercion](coercion.md) exceptions
|
||||
* [Muuntaja](https://github.com/metosin/muuntaja) decode exceptions
|
||||
* Exceptions with `:type` of `:reitit.ring/response`, returning `:response` key from `ex-data`.
|
||||
* Safely all other exceptions
|
||||
|
||||
```clj
|
||||
(require '[reitit.ring :as ring])
|
||||
|
||||
(def app
|
||||
(ring/ring-handler
|
||||
(ring/router
|
||||
["/fail" (fn [_] (throw (Exception. "fail")))]
|
||||
{:data {:middleware [exception/exception-middleware]}})))
|
||||
|
||||
(app {:request-method :get, :uri "/fail"})
|
||||
;{:status 500
|
||||
; :body {:type "exception"
|
||||
; :class "java.lang.Exception"}}
|
||||
```
|
||||
|
||||
### `exception/create-exception-middleware`
|
||||
|
||||
Creates the exception-middleware with custom options. Takes a map of `identifier => exception request => response` that is used to select the exception handler for the thrown/raised exception identifier. Exception identifier is either a `Keyword` or a Exception Class.
|
||||
|
||||
The following handlers are available by default:
|
||||
|
||||
| key | description
|
||||
|--------------------------------------|-------------
|
||||
| `:reitit.ring/response` | value in ex-data key `:response` will be returned
|
||||
| `:muuntaja/decode` | handle Muuntaja decoding exceptions
|
||||
| `:reitit.coercion/request-coercion` | request coercion errors (http 400 response)
|
||||
| `:reitit.coercion/response-coercion` | response coercion errors (http 500 response)
|
||||
| `::exception/default` | a default exception handler if nothing else matched (default `exception/default-handler`).
|
||||
| `::exception/wrap` | a 3-arity handler to wrap the actual handler `handler exception request => response` (no default).
|
||||
|
||||
The handler is selected from the options map by exception identifier in the following lookup order:
|
||||
|
||||
1) `:type` of exception ex-data
|
||||
2) Class of exception
|
||||
3) `:type` ancestors of exception ex-data
|
||||
4) Super Classes of exception
|
||||
5) The ::default handler
|
||||
|
||||
```clj
|
||||
;; type hierarchy
|
||||
(derive ::error ::exception)
|
||||
(derive ::failure ::exception)
|
||||
(derive ::horror ::exception)
|
||||
|
||||
(defn handler [message exception request]
|
||||
{:status 500
|
||||
:body {:message message
|
||||
:exception (.getClass exception)
|
||||
:data (ex-data exception)
|
||||
:uri (:uri request)}})
|
||||
|
||||
(def exception-middleware
|
||||
(exception/create-exception-middleware
|
||||
(merge
|
||||
exception/default-handlers
|
||||
{;; ex-data with :type ::error
|
||||
::error (partial handler "error")
|
||||
|
||||
;; ex-data with ::exception or ::failure
|
||||
::exception (partial handler "exception")
|
||||
|
||||
;; SQLException and all it's child classes
|
||||
java.sql.SQLException (partial handler "sql-exception")
|
||||
|
||||
;; override the default handler
|
||||
::exception/default (partial handler "default")
|
||||
|
||||
;; print stack-traces for all exceptions
|
||||
::exception/wrap (fn [handler e request]
|
||||
(println "ERROR" (pr-str (:uri request)))
|
||||
(handler e request))})))
|
||||
|
||||
(def app
|
||||
(ring/ring-handler
|
||||
(ring/router
|
||||
["/fail" (fn [_] (throw (ex-info "fail" {:type ::failue})))]
|
||||
{:data {:middleware [exception-middleware]}})))
|
||||
|
||||
(app {:request-method :get, :uri "/fail"})
|
||||
; ERROR "/fail"
|
||||
; => {:status 500,
|
||||
; :body {:message "default"
|
||||
; :exception clojure.lang.ExceptionInfo
|
||||
; :data {:type :user/failue}
|
||||
; :uri "/fail"}}
|
||||
```
|
||||
848
ring/index.html
848
ring/index.html
|
|
@ -1,848 +0,0 @@
|
|||
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="" >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>Ring · GitBook</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="description" content="">
|
||||
<meta name="generator" content="GitBook 3.2.3">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/style.css">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta name="HandheldFriendly" content="true"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
|
||||
<link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
|
||||
|
||||
|
||||
<link rel="next" href="ring.html" />
|
||||
|
||||
|
||||
<link rel="prev" href="../coercion/data_spec_coercion.html" />
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="book">
|
||||
<div class="book-summary">
|
||||
|
||||
|
||||
<div id="book-search-input" role="search">
|
||||
<input type="text" placeholder="Type to search" />
|
||||
</div>
|
||||
|
||||
|
||||
<nav role="navigation">
|
||||
|
||||
|
||||
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1" data-path="../">
|
||||
|
||||
<a href="../">
|
||||
|
||||
|
||||
Introduction
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2" data-path="../basics/">
|
||||
|
||||
<a href="../basics/">
|
||||
|
||||
|
||||
Basics
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.2.1" data-path="../basics/route_syntax.html">
|
||||
|
||||
<a href="../basics/route_syntax.html">
|
||||
|
||||
|
||||
Route Syntax
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.2" data-path="../basics/router.html">
|
||||
|
||||
<a href="../basics/router.html">
|
||||
|
||||
|
||||
Router
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.3" data-path="../basics/path_based_routing.html">
|
||||
|
||||
<a href="../basics/path_based_routing.html">
|
||||
|
||||
|
||||
Path-based Routing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.4" data-path="../basics/name_based_routing.html">
|
||||
|
||||
<a href="../basics/name_based_routing.html">
|
||||
|
||||
|
||||
Name-based Routing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.5" data-path="../basics/route_data.html">
|
||||
|
||||
<a href="../basics/route_data.html">
|
||||
|
||||
|
||||
Route Data
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.6" data-path="../basics/route_data_validation.html">
|
||||
|
||||
<a href="../basics/route_data_validation.html">
|
||||
|
||||
|
||||
Route Data Validation
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.7" data-path="../basics/route_conflicts.html">
|
||||
|
||||
<a href="../basics/route_conflicts.html">
|
||||
|
||||
|
||||
Route Conflicts
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3" data-path="../coercion/">
|
||||
|
||||
<a href="../coercion/">
|
||||
|
||||
|
||||
Coercion
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.3.1" data-path="../coercion/coercion.html">
|
||||
|
||||
<a href="../coercion/coercion.html">
|
||||
|
||||
|
||||
Coercion Explained
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.2" data-path="../coercion/schema_coercion.html">
|
||||
|
||||
<a href="../coercion/schema_coercion.html">
|
||||
|
||||
|
||||
Plumatic Schema
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.3" data-path="../coercion/clojure_spec_coercion.html">
|
||||
|
||||
<a href="../coercion/clojure_spec_coercion.html">
|
||||
|
||||
|
||||
Clojure.spec
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.4" data-path="../coercion/data_spec_coercion.html">
|
||||
|
||||
<a href="../coercion/data_spec_coercion.html">
|
||||
|
||||
|
||||
Data-specs
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter active" data-level="1.4" data-path="./">
|
||||
|
||||
<a href="./">
|
||||
|
||||
|
||||
Ring
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.4.1" data-path="ring.html">
|
||||
|
||||
<a href="ring.html">
|
||||
|
||||
|
||||
Ring-router
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.2" data-path="reverse_routing.html">
|
||||
|
||||
<a href="reverse_routing.html">
|
||||
|
||||
|
||||
Reverse-routing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.3" data-path="default_handler.html">
|
||||
|
||||
<a href="default_handler.html">
|
||||
|
||||
|
||||
Default handler
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.4" data-path="static.html">
|
||||
|
||||
<a href="static.html">
|
||||
|
||||
|
||||
Static Resources
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.5" data-path="dynamic_extensions.html">
|
||||
|
||||
<a href="dynamic_extensions.html">
|
||||
|
||||
|
||||
Dynamic Extensions
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.6" data-path="data_driven_middleware.html">
|
||||
|
||||
<a href="data_driven_middleware.html">
|
||||
|
||||
|
||||
Data-driven Middleware
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.7" data-path="transforming_middleware_chain.html">
|
||||
|
||||
<a href="transforming_middleware_chain.html">
|
||||
|
||||
|
||||
Transforming Middleware Chain
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.8" data-path="middleware_registry.html">
|
||||
|
||||
<a href="middleware_registry.html">
|
||||
|
||||
|
||||
Middleware Registry
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.9" data-path="default_middleware.html">
|
||||
|
||||
<a href="default_middleware.html">
|
||||
|
||||
|
||||
Default Middleware
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.10" data-path="coercion.html">
|
||||
|
||||
<a href="coercion.html">
|
||||
|
||||
|
||||
Pluggable Coercion
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.11" data-path="route_data_validation.html">
|
||||
|
||||
<a href="route_data_validation.html">
|
||||
|
||||
|
||||
Route Data Validation
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.12" data-path="compiling_middleware.html">
|
||||
|
||||
<a href="compiling_middleware.html">
|
||||
|
||||
|
||||
Compiling Middleware
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.13" data-path="swagger.html">
|
||||
|
||||
<a href="swagger.html">
|
||||
|
||||
|
||||
Swagger Support
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5" data-path="../advanced/">
|
||||
|
||||
<a href="../advanced/">
|
||||
|
||||
|
||||
Advanced
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.5.1" data-path="../advanced/configuring_routers.html">
|
||||
|
||||
<a href="../advanced/configuring_routers.html">
|
||||
|
||||
|
||||
Configuring Routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.2" data-path="../advanced/composing_routers.html">
|
||||
|
||||
<a href="../advanced/composing_routers.html">
|
||||
|
||||
|
||||
Composing Routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.3" data-path="../advanced/different_routers.html">
|
||||
|
||||
<a href="../advanced/different_routers.html">
|
||||
|
||||
|
||||
Different Routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.4" data-path="../advanced/route_validation.html">
|
||||
|
||||
<a href="../advanced/route_validation.html">
|
||||
|
||||
|
||||
Route Validation
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.5" data-path="../advanced/dev_workflow.html">
|
||||
|
||||
<a href="../advanced/dev_workflow.html">
|
||||
|
||||
|
||||
Dev Workflow
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.6" data-path="../patterns/">
|
||||
|
||||
<a href="../patterns/">
|
||||
|
||||
|
||||
Patterns
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.6.1" data-path="../patterns/shared_routes.html">
|
||||
|
||||
<a href="../patterns/shared_routes.html">
|
||||
|
||||
|
||||
Shared Routes
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.7" data-path="../frontend/">
|
||||
|
||||
<a href="../frontend/">
|
||||
|
||||
|
||||
Frontend
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.7.1" data-path="../frontend/basics.html">
|
||||
|
||||
<a href="../frontend/basics.html">
|
||||
|
||||
|
||||
Basics
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.7.2" data-path="../frontend/browser.html">
|
||||
|
||||
<a href="../frontend/browser.html">
|
||||
|
||||
|
||||
Browser integration
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.7.3" data-path="../frontend/controllers.html">
|
||||
|
||||
<a href="../frontend/controllers.html">
|
||||
|
||||
|
||||
Controllers (WIP)
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.8" data-path="../performance.html">
|
||||
|
||||
<a href="../performance.html">
|
||||
|
||||
|
||||
Performance
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.9" data-path="../interceptors.html">
|
||||
|
||||
<a href="../interceptors.html">
|
||||
|
||||
|
||||
Interceptors (WIP)
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.10" data-path="../development.html">
|
||||
|
||||
<a href="../development.html">
|
||||
|
||||
|
||||
Development Instructions
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.11" data-path="../faq.html">
|
||||
|
||||
<a href="../faq.html">
|
||||
|
||||
|
||||
FAQ
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
<li>
|
||||
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
|
||||
Published with GitBook
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="book-body">
|
||||
|
||||
<div class="body-inner">
|
||||
|
||||
|
||||
|
||||
<div class="book-header" role="navigation">
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
<i class="fa fa-circle-o-notch fa-spin"></i>
|
||||
<a href=".." >Ring</a>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="page-wrapper" tabindex="-1" role="main">
|
||||
<div class="page-inner">
|
||||
|
||||
<div id="book-search-results">
|
||||
<div class="search-noresults">
|
||||
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<h1 id="ring">Ring</h1>
|
||||
<ul>
|
||||
<li><a href="ring.html">Ring-router</a></li>
|
||||
<li><a href="reverse_routing.html">Reverse-routing</a></li>
|
||||
<li><a href="default_handler.html">Default handler</a></li>
|
||||
<li><a href="static.html">Static Resources</a></li>
|
||||
<li><a href="dynamic_extensions.html">Dynamic Extensions</a></li>
|
||||
<li><a href="data_driven_middleware.html">Data-driven Middleware</a></li>
|
||||
<li><a href="transforming_middleware_chain.html">Transforming Middleware Chain</a></li>
|
||||
<li><a href="middleware_registry.html">Middleware Registry</a></li>
|
||||
<li><a href="default_middleware.html">Default Middleware</a></li>
|
||||
<li><a href="coercion.html">Pluggable Coercion</a></li>
|
||||
<li><a href="route_data_validation.html">Route Data Validation</a></li>
|
||||
<li><a href="compiling_middleware.html">Compiling Middleware</a></li>
|
||||
<li><a href="swagger.html">Swagger Support</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
<div class="search-results">
|
||||
<div class="has-results">
|
||||
|
||||
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
|
||||
<ul class="search-results-list"></ul>
|
||||
|
||||
</div>
|
||||
<div class="no-results">
|
||||
|
||||
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<a href="../coercion/data_spec_coercion.html" class="navigation navigation-prev " aria-label="Previous page: Data-specs">
|
||||
<i class="fa fa-angle-left"></i>
|
||||
</a>
|
||||
|
||||
|
||||
<a href="ring.html" class="navigation navigation-next " aria-label="Next page: Ring-router">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Ring","level":"1.4","depth":1,"next":{"title":"Ring-router","level":"1.4.1","depth":2,"path":"ring/ring.md","ref":"ring/ring.md","articles":[]},"previous":{"title":"Data-specs","level":"1.3.4","depth":2,"path":"coercion/data_spec_coercion.md","ref":"coercion/data_spec_coercion.md","articles":[]},"dir":"ltr"},"config":{"plugins":["editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"github":{"url":"https://github.com/metosin/reitit"},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"ring/README.md","mtime":"2018-09-02T14:52:37.221Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-02T14:53:17.801Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook.js"></script>
|
||||
<script src="../gitbook/theme.js"></script>
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-editlink/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-github/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-search/search.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
@ -892,7 +892,7 @@
|
|||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Middleware Registry","level":"4.9","depth":1,"next":{"title":"Exception Handling with Ring","level":"4.10","depth":1,"path":"ring/exceptions.md","ref":"ring/exceptions.md","articles":[]},"previous":{"title":"Transforming Middleware Chain","level":"4.8","depth":1,"path":"ring/transforming_middleware_chain.md","ref":"ring/transforming_middleware_chain.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"ring/middleware_registry.md","mtime":"2020-01-14T13:47:50.994Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-24T11:08:28.724Z"},"basePath":"..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Middleware Registry","level":"4.9","depth":1,"next":{"title":"Exception Handling with Ring","level":"4.10","depth":1,"path":"ring/exceptions.md","ref":"ring/exceptions.md","articles":[]},"previous":{"title":"Transforming Middleware Chain","level":"4.8","depth":1,"path":"ring/transforming_middleware_chain.md","ref":"ring/transforming_middleware_chain.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"ring/middleware_registry.md","mtime":"2020-01-14T13:47:50.994Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-28T09:52:25.779Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,596 +0,0 @@
|
|||
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="" >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>Parameter coercion · GitBook</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="description" content="">
|
||||
<meta name="generator" content="GitBook 3.2.3">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/style.css">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta name="HandheldFriendly" content="true"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
|
||||
<link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
|
||||
|
||||
|
||||
<link rel="next" href="compiling_middleware.html" />
|
||||
|
||||
|
||||
<link rel="prev" href="data_driven_middleware.html" />
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="book">
|
||||
<div class="book-summary">
|
||||
|
||||
|
||||
<div id="book-search-input" role="search">
|
||||
<input type="text" placeholder="Type to search" />
|
||||
</div>
|
||||
|
||||
|
||||
<nav role="navigation">
|
||||
|
||||
|
||||
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1" data-path="../">
|
||||
|
||||
<a href="../">
|
||||
|
||||
|
||||
Introduction
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2" data-path="../basics/">
|
||||
|
||||
<a href="../basics/">
|
||||
|
||||
|
||||
Basics
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.2.1" data-path="../basics/route_syntax.html">
|
||||
|
||||
<a href="../basics/route_syntax.html">
|
||||
|
||||
|
||||
Route syntax
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.2" data-path="../basics/router.html">
|
||||
|
||||
<a href="../basics/router.html">
|
||||
|
||||
|
||||
Router
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.3" data-path="../basics/path_based_routing.html">
|
||||
|
||||
<a href="../basics/path_based_routing.html">
|
||||
|
||||
|
||||
Path-based Routing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.4" data-path="../basics/name_based_routing.html">
|
||||
|
||||
<a href="../basics/name_based_routing.html">
|
||||
|
||||
|
||||
Name-based Routing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.5" data-path="../basics/route_data.html">
|
||||
|
||||
<a href="../basics/route_data.html">
|
||||
|
||||
|
||||
Route data
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.6" data-path="../basics/route_conflicts.html">
|
||||
|
||||
<a href="../basics/route_conflicts.html">
|
||||
|
||||
|
||||
Route conflicts
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3" data-path="../advanced/">
|
||||
|
||||
<a href="../advanced/">
|
||||
|
||||
|
||||
Advanced
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.3.1" data-path="../advanced/configuring_routers.html">
|
||||
|
||||
<a href="../advanced/configuring_routers.html">
|
||||
|
||||
|
||||
Configuring routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.2" data-path="../advanced/different_routers.html">
|
||||
|
||||
<a href="../advanced/different_routers.html">
|
||||
|
||||
|
||||
Different Routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.3" data-path="../advanced/route_validation.html">
|
||||
|
||||
<a href="../advanced/route_validation.html">
|
||||
|
||||
|
||||
Route Validation
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4" data-path="./">
|
||||
|
||||
<a href="./">
|
||||
|
||||
|
||||
Ring
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.4.1" data-path="ring.html">
|
||||
|
||||
<a href="ring.html">
|
||||
|
||||
|
||||
Ring-router
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.2" data-path="dynamic_extensions.html">
|
||||
|
||||
<a href="dynamic_extensions.html">
|
||||
|
||||
|
||||
Dynamic extensions
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.3" data-path="data_driven_middleware.html">
|
||||
|
||||
<a href="data_driven_middleware.html">
|
||||
|
||||
|
||||
Data-driven Middleware
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter active" data-level="1.4.4" data-path="parameter_coercion.html">
|
||||
|
||||
<a href="parameter_coercion.html">
|
||||
|
||||
|
||||
Parameter coercion
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.5" data-path="compiling_middleware.html">
|
||||
|
||||
<a href="compiling_middleware.html">
|
||||
|
||||
|
||||
Compiling middleware
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5" data-path="../performance.html">
|
||||
|
||||
<a href="../performance.html">
|
||||
|
||||
|
||||
Performance
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.6" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
TODO: Swagger & OpenAPI
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.7" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
TODO: Interceptors
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
<li>
|
||||
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
|
||||
Published with GitBook
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="book-body">
|
||||
|
||||
<div class="body-inner">
|
||||
|
||||
|
||||
|
||||
<div class="book-header" role="navigation">
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
<i class="fa fa-circle-o-notch fa-spin"></i>
|
||||
<a href=".." >Parameter coercion</a>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="page-wrapper" tabindex="-1" role="main">
|
||||
<div class="page-inner">
|
||||
|
||||
<div id="book-search-results">
|
||||
<div class="search-noresults">
|
||||
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<h1 id="parameter-coercion">Parameter coercion</h1>
|
||||
<p>Reitit provides pluggable parameter coercion via <code>reitit.ring.coercion.protocol/Coercion</code> protocol, originally introduced in <a href="https://clojars.org/metosin/compojure-api" target="_blank">compojure-api</a>. Reitit ships with <code>reitit.ring.coercion.spec/SpecCoercion</code> providing implemenation for <a href="https://clojure.org/about/spec" target="_blank">clojure.spec</a> and <a href="https://github.com/metosin/spec-tools#data-specs" target="_blank">data-specs</a>.</p>
|
||||
<p><strong>NOTE</strong>: Before Clojure 1.9.0 is shipped, to use the spec-coercion, one needs to add the following dependencies manually to the project:</p>
|
||||
<pre><code class="lang-clj">[org.clojure/clojure <span class="hljs-string">"1.9.0-beta2"</span>]
|
||||
[org.clojure/spec.alpha <span class="hljs-string">"0.1.123"</span>]
|
||||
[metosin/spec-tools <span class="hljs-string">"0.4.0"</span>]
|
||||
</code></pre>
|
||||
<h3 id="ring-request-and-response-coercion">Ring request and response coercion</h3>
|
||||
<p>To use <code>Coercion</code> with Ring, one needs to do the following:</p>
|
||||
<ol>
|
||||
<li>Define parameters and responses as data into route data, in format adopted from <a href="https://github.com/metosin/ring-swagger#more-complete-example" target="_blank">ring-swagger</a>:<ul>
|
||||
<li><code>:parameters</code> map, with submaps for different parameters: <code>:query</code>, <code>:body</code>, <code>:form</code>, <code>:header</code> and <code>:path</code>. Parameters are defined in the format understood by the <code>Coercion</code>.</li>
|
||||
<li><code>:responses</code> map, with response status codes as keys (or <code>:default</code> for "everything else") with maps with <code>:schema</code> and optionally <code>:description</code> as values.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Define a <code>Coercion</code> to route data under <code>:coercion</code></li>
|
||||
<li>Mount request & response coercion middleware to the routes (recommended to mount to all routes under router as they mounted only to routes which have the parameters / responses defined):<ul>
|
||||
<li><code>reitit.ring.coercion/gen-wrap-coerce-parameters</code></li>
|
||||
<li><code>gen-wrap-coerce-parameters/gen-wrap-coerce-responses</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ol>
|
||||
<p>If the request coercion succeeds, the coerced parameters are injected into request under <code>:parameters</code>.</p>
|
||||
<p>If either request or response coercion fails, an descriptive error is thrown.</p>
|
||||
<h4 id="example-with-data-specs">Example with data-specs</h4>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name">require</span> '[reitit.ring <span class="hljs-symbol">:as</span> ring])
|
||||
(<span class="hljs-name">require</span> '[reitit.ring.coercion <span class="hljs-symbol">:as</span> coercion])
|
||||
(<span class="hljs-name">require</span> '[reitit.ring.coercion.spec <span class="hljs-symbol">:as</span> spec])
|
||||
|
||||
(<span class="hljs-name"><span class="hljs-builtin-name">def</span></span> app
|
||||
(<span class="hljs-name">ring/ring-handler</span>
|
||||
(<span class="hljs-name">ring/router</span>
|
||||
[<span class="hljs-string">"/api"</span>
|
||||
[<span class="hljs-string">"/ping"</span> {<span class="hljs-symbol">:parameters</span> {<span class="hljs-symbol">:body</span> {<span class="hljs-symbol">:x</span> int?, <span class="hljs-symbol">:y</span> int?}}
|
||||
<span class="hljs-symbol">:responses</span> {<span class="hljs-number">200</span> {<span class="hljs-symbol">:schema</span> {<span class="hljs-symbol">:total</span> pos-int?}}}
|
||||
<span class="hljs-symbol">:get</span> {<span class="hljs-symbol">:handler</span> (<span class="hljs-name"><span class="hljs-builtin-name">fn</span></span> [{{{<span class="hljs-symbol">:keys</span> [x y]} <span class="hljs-symbol">:body</span>} <span class="hljs-symbol">:parameters</span>}]
|
||||
{<span class="hljs-symbol">:status</span> <span class="hljs-number">200</span>
|
||||
<span class="hljs-symbol">:body</span> {<span class="hljs-symbol">:total</span> (<span class="hljs-name"><span class="hljs-builtin-name">+</span></span> x y)}})}}]]
|
||||
{<span class="hljs-symbol">:data</span> {<span class="hljs-symbol">:middleware</span> [coercion/gen-wrap-coerce-parameters
|
||||
coercion/gen-wrap-coerce-response]
|
||||
<span class="hljs-symbol">:coercion</span> spec/coercion}})))
|
||||
</code></pre>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name">app</span>
|
||||
{<span class="hljs-symbol">:request-method</span> <span class="hljs-symbol">:get</span>
|
||||
<span class="hljs-symbol">:uri</span> <span class="hljs-string">"/api/ping"</span>
|
||||
<span class="hljs-symbol">:body-params</span> {<span class="hljs-symbol">:x</span> <span class="hljs-number">1</span>, <span class="hljs-symbol">:y</span> <span class="hljs-number">2</span>}})
|
||||
<span class="hljs-comment">; {:status 200, :body {:total 3}}</span>
|
||||
</code></pre>
|
||||
<h4 id="example-with-specs">Example with specs</h4>
|
||||
<p>Currently, <code>clojure.spec</code> <a href="https://dev.clojure.org/jira/browse/CLJ-2116" target="_blank">doesn't support runtime transformations via conforming</a>, so one needs to wrap all specs with <code>spec-tools.core/spec</code>.</p>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name">require</span> '[reitit.ring <span class="hljs-symbol">:as</span> ring])
|
||||
(<span class="hljs-name">require</span> '[reitit.ring.coercion <span class="hljs-symbol">:as</span> coercion])
|
||||
(<span class="hljs-name">require</span> '[reitit.ring.coercion.spec <span class="hljs-symbol">:as</span> spec])
|
||||
(<span class="hljs-name">require</span> '[clojure.spec.alpha <span class="hljs-symbol">:as</span> s])
|
||||
(<span class="hljs-name">require</span> '[spec-tools.core <span class="hljs-symbol">:as</span> st])
|
||||
|
||||
(<span class="hljs-name">s/def</span> <span class="hljs-symbol">::x</span> (<span class="hljs-name">st/spec</span> int?))
|
||||
(<span class="hljs-name">s/def</span> <span class="hljs-symbol">::y</span> (<span class="hljs-name">st/spec</span> int?))
|
||||
(<span class="hljs-name">s/def</span> <span class="hljs-symbol">::total</span> int?)
|
||||
(<span class="hljs-name">s/def</span> <span class="hljs-symbol">::request</span> (<span class="hljs-name">s/keys</span> <span class="hljs-symbol">:req-un</span> [<span class="hljs-symbol">::x</span> <span class="hljs-symbol">::y</span>]))
|
||||
(<span class="hljs-name">s/def</span> <span class="hljs-symbol">::response</span> (<span class="hljs-name">s/keys</span> <span class="hljs-symbol">:req-un</span> [<span class="hljs-symbol">::total</span>]))
|
||||
|
||||
(<span class="hljs-name"><span class="hljs-builtin-name">def</span></span> app
|
||||
(<span class="hljs-name">ring/ring-handler</span>
|
||||
(<span class="hljs-name">ring/router</span>
|
||||
[<span class="hljs-string">"/api"</span>
|
||||
[<span class="hljs-string">"/ping"</span> {<span class="hljs-symbol">:parameters</span> {<span class="hljs-symbol">:body</span> <span class="hljs-symbol">::request</span>}
|
||||
<span class="hljs-symbol">:responses</span> {<span class="hljs-number">200</span> {<span class="hljs-symbol">:schema</span> <span class="hljs-symbol">::response</span>}}
|
||||
<span class="hljs-symbol">:get</span> {<span class="hljs-symbol">:handler</span> (<span class="hljs-name"><span class="hljs-builtin-name">fn</span></span> [{{{<span class="hljs-symbol">:keys</span> [x y]} <span class="hljs-symbol">:body</span>} <span class="hljs-symbol">:parameters</span>}]
|
||||
{<span class="hljs-symbol">:status</span> <span class="hljs-number">200</span>
|
||||
<span class="hljs-symbol">:body</span> {<span class="hljs-symbol">:total</span> (<span class="hljs-name"><span class="hljs-builtin-name">+</span></span> x y)}})}}]]
|
||||
{<span class="hljs-symbol">:data</span> {<span class="hljs-symbol">:middleware</span> [coercion/gen-wrap-coerce-parameters
|
||||
coercion/gen-wrap-coerce-response]
|
||||
<span class="hljs-symbol">:coercion</span> spec/coercion}})))
|
||||
</code></pre>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name">app</span>
|
||||
{<span class="hljs-symbol">:request-method</span> <span class="hljs-symbol">:get</span>
|
||||
<span class="hljs-symbol">:uri</span> <span class="hljs-string">"/api/ping"</span>
|
||||
<span class="hljs-symbol">:body-params</span> {<span class="hljs-symbol">:x</span> <span class="hljs-number">1</span>, <span class="hljs-symbol">:y</span> <span class="hljs-number">2</span>}})
|
||||
<span class="hljs-comment">; {:status 200, :body {:total 3}}</span>
|
||||
</code></pre>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
<div class="search-results">
|
||||
<div class="has-results">
|
||||
|
||||
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
|
||||
<ul class="search-results-list"></ul>
|
||||
|
||||
</div>
|
||||
<div class="no-results">
|
||||
|
||||
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<a href="data_driven_middleware.html" class="navigation navigation-prev " aria-label="Previous page: Data-driven Middleware">
|
||||
<i class="fa fa-angle-left"></i>
|
||||
</a>
|
||||
|
||||
|
||||
<a href="compiling_middleware.html" class="navigation navigation-next " aria-label="Next page: Compiling middleware">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Parameter coercion","level":"1.4.4","depth":2,"next":{"title":"Compiling middleware","level":"1.4.5","depth":2,"path":"ring/compiling_middleware.md","ref":"ring/compiling_middleware.md","articles":[]},"previous":{"title":"Data-driven Middleware","level":"1.4.3","depth":2,"path":"ring/data_driven_middleware.md","ref":"ring/data_driven_middleware.md","articles":[]},"dir":"ltr"},"config":{"plugins":["editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"github":{"url":"https://github.com/metosin/reitit"},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"ring/parameter_coercion.md","mtime":"2017-11-20T13:17:36.673Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2017-11-20T13:18:13.394Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook.js"></script>
|
||||
<script src="../gitbook/theme.js"></script>
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-editlink/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-github/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-search/search.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
@ -877,7 +877,7 @@
|
|||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Reverse-routing","level":"4.2","depth":1,"next":{"title":"Default handler","level":"4.3","depth":1,"path":"ring/default_handler.md","ref":"ring/default_handler.md","articles":[]},"previous":{"title":"Ring-router","level":"4.1","depth":1,"path":"ring/ring.md","ref":"ring/ring.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"ring/reverse_routing.md","mtime":"2020-01-14T13:47:50.994Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-24T11:08:28.724Z"},"basePath":"..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Reverse-routing","level":"4.2","depth":1,"next":{"title":"Default handler","level":"4.3","depth":1,"path":"ring/default_handler.md","ref":"ring/default_handler.md","articles":[]},"previous":{"title":"Ring-router","level":"4.1","depth":1,"path":"ring/ring.md","ref":"ring/ring.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"ring/reverse_routing.md","mtime":"2020-01-14T13:47:50.994Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-28T09:52:25.779Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1021,7 +1021,7 @@
|
|||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Ring-router","level":"4.1","depth":1,"next":{"title":"Reverse-routing","level":"4.2","depth":1,"path":"ring/reverse_routing.md","ref":"ring/reverse_routing.md","articles":[]},"previous":{"title":"Data-specs","level":"3.4","depth":1,"path":"coercion/data_spec_coercion.md","ref":"coercion/data_spec_coercion.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"ring/ring.md","mtime":"2020-07-24T09:34:09.877Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-24T11:08:28.724Z"},"basePath":"..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Ring-router","level":"4.1","depth":1,"next":{"title":"Reverse-routing","level":"4.2","depth":1,"path":"ring/reverse_routing.md","ref":"ring/reverse_routing.md","articles":[]},"previous":{"title":"Data-specs","level":"3.4","depth":1,"path":"coercion/data_spec_coercion.md","ref":"coercion/data_spec_coercion.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"ring/ring.md","mtime":"2020-07-24T09:34:09.877Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-28T09:52:25.779Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1089,7 +1089,7 @@
|
|||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Route Data Validation","level":"4.14","depth":1,"next":{"title":"Compiling Middleware","level":"4.15","depth":1,"path":"ring/compiling_middleware.md","ref":"ring/compiling_middleware.md","articles":[]},"previous":{"title":"Pluggable Coercion","level":"4.13","depth":1,"path":"ring/coercion.md","ref":"ring/coercion.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"ring/route_data_validation.md","mtime":"2020-01-14T13:47:50.996Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-24T11:08:28.724Z"},"basePath":"..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Route Data Validation","level":"4.14","depth":1,"next":{"title":"Compiling Middleware","level":"4.15","depth":1,"path":"ring/compiling_middleware.md","ref":"ring/compiling_middleware.md","articles":[]},"previous":{"title":"Pluggable Coercion","level":"4.13","depth":1,"path":"ring/coercion.md","ref":"ring/coercion.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"ring/route_data_validation.md","mtime":"2020-01-14T13:47:50.996Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-28T09:52:25.779Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -915,7 +915,7 @@
|
|||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Slash handler","level":"4.4","depth":1,"next":{"title":"Static Resources","level":"4.5","depth":1,"path":"ring/static.md","ref":"ring/static.md","articles":[]},"previous":{"title":"Default handler","level":"4.3","depth":1,"path":"ring/default_handler.md","ref":"ring/default_handler.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"ring/slash_handler.md","mtime":"2020-01-14T13:47:50.997Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-24T11:08:28.724Z"},"basePath":"..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Slash handler","level":"4.4","depth":1,"next":{"title":"Static Resources","level":"4.5","depth":1,"path":"ring/static.md","ref":"ring/static.md","articles":[]},"previous":{"title":"Default handler","level":"4.3","depth":1,"path":"ring/default_handler.md","ref":"ring/default_handler.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"ring/slash_handler.md","mtime":"2020-01-14T13:47:50.997Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-28T09:52:25.779Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,64 +0,0 @@
|
|||
# Slash handler
|
||||
|
||||
The router works with precise matches. If a route is defined without a trailing slash, for example, it won't match a request with a slash.
|
||||
|
||||
```clj
|
||||
(require '[reitit.ring :as ring])
|
||||
|
||||
(def app
|
||||
(ring/ring-handler
|
||||
(ring/router
|
||||
["/ping" (constantly {:status 200, :body ""})])))
|
||||
|
||||
(app {:uri "/ping/"})
|
||||
; nil
|
||||
```
|
||||
|
||||
Sometimes it is desirable that paths with and without a trailing slash are recognized as the same.
|
||||
|
||||
Setting the `redirect-trailing-slash-handler` as a second argument to `ring-handler`:
|
||||
|
||||
```clj
|
||||
(def app
|
||||
(ring/ring-handler
|
||||
(ring/router
|
||||
[["/ping" (constantly {:status 200, :body ""})]
|
||||
["/pong/" (constantly {:status 200, :body ""})]])
|
||||
(ring/redirect-trailing-slash-handler)))
|
||||
|
||||
(app {:uri "/ping/"})
|
||||
; {:status 308, :headers {"Location" "/ping"}, :body ""}
|
||||
(app {:uri "/pong"})
|
||||
; {:status 308, :headers {"Location" "/pong/"}, :body ""}
|
||||
```
|
||||
|
||||
`redirect-trailing-slash-handler` accepts an optional `:method` parameter that allows configuring how (whether) to handle missing/extra slashes. The default is to handle both.
|
||||
|
||||
```clj
|
||||
(def app
|
||||
(ring/ring-handler
|
||||
(ring/router
|
||||
[["/ping" (constantly {:status 200, :body ""})]
|
||||
["/pong/" (constantly {:status 200, :body ""})]])
|
||||
; only handle extra trailing slash
|
||||
(ring/redirect-trailing-slash-handler {:method :strip})))
|
||||
|
||||
(app {:uri "/ping/"})
|
||||
; {:status 308, :headers {"Location" "/ping"}, :body ""}
|
||||
(app {:uri "/pong"})
|
||||
; nil
|
||||
```
|
||||
```clj
|
||||
(def app
|
||||
(ring/ring-handler
|
||||
(ring/router
|
||||
[["/ping" (constantly {:status 200, :body ""})]
|
||||
["/pong/" (constantly {:status 200, :body ""})]])
|
||||
; only handle missing trailing slash
|
||||
(ring/redirect-trailing-slash-handler {:method :add})))
|
||||
|
||||
(app {:uri "/ping/"})
|
||||
; nil
|
||||
(app {:uri "/pong"})
|
||||
; {:status 308, :headers {"Location" "/pong/"}, :body ""}
|
||||
```
|
||||
|
|
@ -917,7 +917,7 @@
|
|||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Static Resources","level":"4.5","depth":1,"next":{"title":"Dynamic Extensions","level":"4.6","depth":1,"path":"ring/dynamic_extensions.md","ref":"ring/dynamic_extensions.md","articles":[]},"previous":{"title":"Slash handler","level":"4.4","depth":1,"path":"ring/slash_handler.md","ref":"ring/slash_handler.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"ring/static.md","mtime":"2020-01-14T13:47:50.997Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-24T11:08:28.724Z"},"basePath":"..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Static Resources","level":"4.5","depth":1,"next":{"title":"Dynamic Extensions","level":"4.6","depth":1,"path":"ring/dynamic_extensions.md","ref":"ring/dynamic_extensions.md","articles":[]},"previous":{"title":"Slash handler","level":"4.4","depth":1,"path":"ring/slash_handler.md","ref":"ring/slash_handler.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"ring/static.md","mtime":"2020-01-14T13:47:50.997Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-28T09:52:25.779Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1141,7 +1141,7 @@ see the next example</li>
|
|||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Swagger Support","level":"4.16","depth":1,"next":{"title":"RESTful form methods","level":"4.17","depth":1,"path":"ring/RESTful_form_methods.md","ref":"ring/RESTful_form_methods.md","articles":[]},"previous":{"title":"Compiling Middleware","level":"4.15","depth":1,"path":"ring/compiling_middleware.md","ref":"ring/compiling_middleware.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"ring/swagger.md","mtime":"2020-07-24T09:34:09.877Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-24T11:08:28.724Z"},"basePath":"..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Swagger Support","level":"4.16","depth":1,"next":{"title":"RESTful form methods","level":"4.17","depth":1,"path":"ring/RESTful_form_methods.md","ref":"ring/RESTful_form_methods.md","articles":[]},"previous":{"title":"Compiling Middleware","level":"4.15","depth":1,"path":"ring/compiling_middleware.md","ref":"ring/compiling_middleware.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"ring/swagger.md","mtime":"2020-07-24T09:34:09.877Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-28T09:52:25.779Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -898,7 +898,7 @@
|
|||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Transforming Middleware Chain","level":"4.8","depth":1,"next":{"title":"Middleware Registry","level":"4.9","depth":1,"path":"ring/middleware_registry.md","ref":"ring/middleware_registry.md","articles":[]},"previous":{"title":"Data-driven Middleware","level":"4.7","depth":1,"path":"ring/data_driven_middleware.md","ref":"ring/data_driven_middleware.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"ring/transforming_middleware_chain.md","mtime":"2020-07-24T09:34:09.878Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-24T11:08:28.724Z"},"basePath":"..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Transforming Middleware Chain","level":"4.8","depth":1,"next":{"title":"Middleware Registry","level":"4.9","depth":1,"path":"ring/middleware_registry.md","ref":"ring/middleware_registry.md","articles":[]},"previous":{"title":"Data-driven Middleware","level":"4.7","depth":1,"path":"ring/data_driven_middleware.md","ref":"ring/data_driven_middleware.md","articles":[]},"dir":"ltr"},"config":{"plugins":["hints","editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/metosin/reitit"},"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"search":{},"hints":{"danger":"fa fa-exclamation-circle","info":"fa fa-info-circle","tip":"fa fa-mortar-board","working":"fa fa-wrench"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"ring/transforming_middleware_chain.md","mtime":"2020-07-24T09:34:09.878Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-28T09:52:25.779Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,37 +0,0 @@
|
|||
# Transformation Middleware Chain
|
||||
|
||||
There is an extra option in ring-router (actually, in the underlying middleware-router): `:reitit.middleware/transform` to transform the middleware chain per endpoint. It gets the vector of compiled middleware and should return a new vector of middleware.
|
||||
|
||||
## Adding debug middleware between all other middleware
|
||||
|
||||
```clj
|
||||
(def app
|
||||
(ring/ring-handler
|
||||
(ring/router
|
||||
["/api" {:middleware [[wrap 1] [wrap2 2]]}
|
||||
["/ping" {:get {:middleware [[wrap3 3]]
|
||||
:handler handler}}]]
|
||||
{::middleware/transform #(interleave % (repeat [wrap :debug]))})))
|
||||
```
|
||||
|
||||
```clj
|
||||
(app {:request-method :get, :uri "/api/ping"})
|
||||
; {:status 200, :body [1 :debug 2 :debug 3 :debug :handler]}
|
||||
```
|
||||
|
||||
## Reversing the middleware chain
|
||||
|
||||
```clj
|
||||
(def app
|
||||
(ring/ring-handler
|
||||
(ring/router
|
||||
["/api" {:middleware [[wrap 1] [wrap2 2]]}
|
||||
["/ping" {:get {:middleware [[wrap3 3]]
|
||||
:handler handler}}]]
|
||||
{::middleware/transform reverse)})))
|
||||
```
|
||||
|
||||
```clj
|
||||
(app {:request-method :get, :uri "/api/ping"})
|
||||
; {:status 200, :body [3 2 1 :handler]}
|
||||
```
|
||||
|
|
@ -1,528 +0,0 @@
|
|||
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="" >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>Route conflicts · GitBook</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="description" content="">
|
||||
<meta name="generator" content="GitBook 3.2.3">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="gitbook/style.css">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="gitbook/gitbook-plugin-highlight/website.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="gitbook/gitbook-plugin-search/search.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta name="HandheldFriendly" content="true"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
|
||||
<link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">
|
||||
|
||||
|
||||
<link rel="next" href="route_validation.html" />
|
||||
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="book">
|
||||
<div class="book-summary">
|
||||
|
||||
|
||||
<div id="book-search-input" role="search">
|
||||
<input type="text" placeholder="Type to search" />
|
||||
</div>
|
||||
|
||||
|
||||
<nav role="navigation">
|
||||
|
||||
|
||||
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1" data-path="./">
|
||||
|
||||
<a href="./">
|
||||
|
||||
|
||||
Introduction
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
Basics
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.2.1" data-path="basics.html">
|
||||
|
||||
<a href="basics.html#route-syntax">
|
||||
|
||||
|
||||
Route syntax
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.2" data-path="basics.html">
|
||||
|
||||
<a href="basics.html#router">
|
||||
|
||||
|
||||
Router
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.3" data-path="basics.html">
|
||||
|
||||
<a href="basics.html#path-based-routing">
|
||||
|
||||
|
||||
Path-based Routing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.4" data-path="basics.html">
|
||||
|
||||
<a href="basics.html#name-based-routing">
|
||||
|
||||
|
||||
Name-based Routing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.5" data-path="basics.html">
|
||||
|
||||
<a href="basics.html#route-data">
|
||||
|
||||
|
||||
Route data
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.6" data-path="basics.html">
|
||||
|
||||
<a href="basics.html#different-routers">
|
||||
|
||||
|
||||
Different Routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
Advanced
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter active" data-level="1.3.1" data-path="route_conflicts.html">
|
||||
|
||||
<a href="route_conflicts.html">
|
||||
|
||||
|
||||
Route conflicts
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.2" data-path="route_validation.html">
|
||||
|
||||
<a href="route_validation.html">
|
||||
|
||||
|
||||
Route Validation
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.3" data-path="configuring_routers.html">
|
||||
|
||||
<a href="configuring_routers.html">
|
||||
|
||||
|
||||
Configuring routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
Ring
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.4.1" data-path="ring.html">
|
||||
|
||||
<a href="ring.html">
|
||||
|
||||
|
||||
Ring-router
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.2" data-path="dynamic_extensions.html">
|
||||
|
||||
<a href="dynamic_extensions.html">
|
||||
|
||||
|
||||
Dynamic extensions
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.3" data-path="parameter_coercion.html">
|
||||
|
||||
<a href="parameter_coercion.html">
|
||||
|
||||
|
||||
Parameter coercion
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.4" data-path="compiling_middleware.html">
|
||||
|
||||
<a href="compiling_middleware.html">
|
||||
|
||||
|
||||
Compiling middleware
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
TODO: Swagger & OpenAPI
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.6" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
TODO: Interceptors
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
<li>
|
||||
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
|
||||
Published with GitBook
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="book-body">
|
||||
|
||||
<div class="body-inner">
|
||||
|
||||
|
||||
|
||||
<div class="book-header" role="navigation">
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
<i class="fa fa-circle-o-notch fa-spin"></i>
|
||||
<a href="." >Route conflicts</a>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="page-wrapper" tabindex="-1" role="main">
|
||||
<div class="page-inner">
|
||||
|
||||
<div id="book-search-results">
|
||||
<div class="search-noresults">
|
||||
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<h1 id="route-conflicts">Route conflicts</h1>
|
||||
<p>Many routing libraries allow single path lookup could match multiple routes. Usually, first match is used. This is not good, especially if route tree is merged from multiple sources - routes might regress to be unreachable without a warning.</p>
|
||||
<p>Reitit resolves this by running explicit conflicit resolution when a <code>Router</code> is created. Conflicting routes are passed into a <code>:conflicts</code> callback. Default implementation throws <code>ex-info</code> with a descriptive message.</p>
|
||||
<p>Examples routes with conflicts:</p>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name">require</span> '[reitit.core <span class="hljs-symbol">:as</span> reitit])
|
||||
|
||||
(<span class="hljs-name"><span class="hljs-builtin-name">def</span></span> routes
|
||||
[[<span class="hljs-string">"/ping"</span>]
|
||||
[<span class="hljs-string">"/:user-id/orders"</span>]
|
||||
[<span class="hljs-string">"/bulk/:bulk-id"</span>]
|
||||
[<span class="hljs-string">"/public/*path"</span>]
|
||||
[<span class="hljs-string">"/:version/status"</span>]])
|
||||
</code></pre>
|
||||
<p>By default, <code>ExceptionInfo</code> is thrown:</p>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name">reitit/router</span> routes)
|
||||
<span class="hljs-comment">; CompilerException clojure.lang.ExceptionInfo: Router contains conflicting routes:</span>
|
||||
<span class="hljs-comment">;</span>
|
||||
<span class="hljs-comment">; /:user-id/orders</span>
|
||||
<span class="hljs-comment">; -> /public/*path</span>
|
||||
<span class="hljs-comment">; -> /bulk/:bulk-id</span>
|
||||
<span class="hljs-comment">;</span>
|
||||
<span class="hljs-comment">; /bulk/:bulk-id</span>
|
||||
<span class="hljs-comment">; -> /:version/status</span>
|
||||
<span class="hljs-comment">;</span>
|
||||
<span class="hljs-comment">; /public/*path</span>
|
||||
<span class="hljs-comment">; -> /:version/status</span>
|
||||
<span class="hljs-comment">;</span>
|
||||
</code></pre>
|
||||
<p>Just logging the conflicts:</p>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name">reitit/router</span>
|
||||
routes
|
||||
{<span class="hljs-symbol">:conflicts</span> (<span class="hljs-name"><span class="hljs-builtin-name">comp</span></span> println reitit/conflicts-str)})
|
||||
<span class="hljs-comment">; Router contains conflicting routes:</span>
|
||||
<span class="hljs-comment">;</span>
|
||||
<span class="hljs-comment">; /:user-id/orders</span>
|
||||
<span class="hljs-comment">; -> /public/*path</span>
|
||||
<span class="hljs-comment">; -> /bulk/:bulk-id</span>
|
||||
<span class="hljs-comment">;</span>
|
||||
<span class="hljs-comment">; /bulk/:bulk-id</span>
|
||||
<span class="hljs-comment">; -> /:version/status</span>
|
||||
<span class="hljs-comment">;</span>
|
||||
<span class="hljs-comment">; /public/*path</span>
|
||||
<span class="hljs-comment">; -> /:version/status</span>
|
||||
<span class="hljs-comment">;</span>
|
||||
</code></pre>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
<div class="search-results">
|
||||
<div class="has-results">
|
||||
|
||||
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
|
||||
<ul class="search-results-list"></ul>
|
||||
|
||||
</div>
|
||||
<div class="no-results">
|
||||
|
||||
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<a href="route_validation.html" class="navigation navigation-next navigation-unique" aria-label="Next page: Route Validation">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Route conflicts","level":"1.3.1","depth":2,"next":{"title":"Route Validation","level":"1.3.2","depth":2,"path":"route_validation.md","ref":"route_validation.md","articles":[]},"previous":{"title":"Advanced","level":"1.3","depth":1,"ref":"","articles":[{"title":"Route conflicts","level":"1.3.1","depth":2,"path":"route_conflicts.md","ref":"route_conflicts.md","articles":[]},{"title":"Route Validation","level":"1.3.2","depth":2,"path":"route_validation.md","ref":"route_validation.md","articles":[]},{"title":"Configuring routers","level":"1.3.3","depth":2,"path":"configuring_routers.md","ref":"configuring_routers.md","articles":[]}]},"dir":"ltr"},"config":{"plugins":["editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"github":{"url":"https://github.com/metosin/reitit"},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"route_conflicts.md","mtime":"2017-10-25T15:00:22.836Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2017-10-25T15:01:14.084Z"},"basePath":".","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
|
||||
<script src="gitbook/gitbook.js"></script>
|
||||
<script src="gitbook/theme.js"></script>
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-editlink/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-github/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-search/search-engine.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-search/search.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-sharing/buttons.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
@ -1,644 +0,0 @@
|
|||
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="" >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>Route Validation · GitBook</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="description" content="">
|
||||
<meta name="generator" content="GitBook 3.2.3">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="gitbook/style.css">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="gitbook/gitbook-plugin-highlight/website.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="gitbook/gitbook-plugin-search/search.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta name="HandheldFriendly" content="true"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
|
||||
<link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">
|
||||
|
||||
|
||||
<link rel="next" href="configuring_routers.html" />
|
||||
|
||||
|
||||
<link rel="prev" href="route_conflicts.html" />
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="book">
|
||||
<div class="book-summary">
|
||||
|
||||
|
||||
<div id="book-search-input" role="search">
|
||||
<input type="text" placeholder="Type to search" />
|
||||
</div>
|
||||
|
||||
|
||||
<nav role="navigation">
|
||||
|
||||
|
||||
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1" data-path="./">
|
||||
|
||||
<a href="./">
|
||||
|
||||
|
||||
Introduction
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
Basics
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.2.1" data-path="basics.html">
|
||||
|
||||
<a href="basics.html#route-syntax">
|
||||
|
||||
|
||||
Route syntax
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.2" data-path="basics.html">
|
||||
|
||||
<a href="basics.html#router">
|
||||
|
||||
|
||||
Router
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.3" data-path="basics.html">
|
||||
|
||||
<a href="basics.html#path-based-routing">
|
||||
|
||||
|
||||
Path-based Routing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.4" data-path="basics.html">
|
||||
|
||||
<a href="basics.html#name-based-routing">
|
||||
|
||||
|
||||
Name-based Routing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.5" data-path="basics.html">
|
||||
|
||||
<a href="basics.html#route-data">
|
||||
|
||||
|
||||
Route data
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.6" data-path="basics.html">
|
||||
|
||||
<a href="basics.html#different-routers">
|
||||
|
||||
|
||||
Different Routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
Advanced
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.3.1" data-path="route_conflicts.html">
|
||||
|
||||
<a href="route_conflicts.html">
|
||||
|
||||
|
||||
Route conflicts
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter active" data-level="1.3.2" data-path="route_validation.html">
|
||||
|
||||
<a href="route_validation.html">
|
||||
|
||||
|
||||
Route Validation
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.3" data-path="configuring_routers.html">
|
||||
|
||||
<a href="configuring_routers.html">
|
||||
|
||||
|
||||
Configuring routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
Ring
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.4.1" data-path="ring.html">
|
||||
|
||||
<a href="ring.html">
|
||||
|
||||
|
||||
Ring-router
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.2" data-path="dynamic_extensions.html">
|
||||
|
||||
<a href="dynamic_extensions.html">
|
||||
|
||||
|
||||
Dynamic extensions
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.3" data-path="parameter_coercion.html">
|
||||
|
||||
<a href="parameter_coercion.html">
|
||||
|
||||
|
||||
Parameter coercion
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.4" data-path="compiling_middleware.html">
|
||||
|
||||
<a href="compiling_middleware.html">
|
||||
|
||||
|
||||
Compiling middleware
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
TODO: Swagger & OpenAPI
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.6" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
TODO: Interceptors
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
<li>
|
||||
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
|
||||
Published with GitBook
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="book-body">
|
||||
|
||||
<div class="body-inner">
|
||||
|
||||
|
||||
|
||||
<div class="book-header" role="navigation">
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
<i class="fa fa-circle-o-notch fa-spin"></i>
|
||||
<a href="." >Route Validation</a>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="page-wrapper" tabindex="-1" role="main">
|
||||
<div class="page-inner">
|
||||
|
||||
<div id="book-search-results">
|
||||
<div class="search-noresults">
|
||||
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<h1 id="route-validation">Route validation</h1>
|
||||
<p>Namespace <code>reitit.spec</code> contains <a href="https://clojure.org/about/spec" target="_blank">clojure.spec</a> definitions for raw-routes, routes, router and router options.</p>
|
||||
<p><strong>NOTE:</strong> Use of specs requires to use one of the following:</p>
|
||||
<ul>
|
||||
<li><code>[org.clojure/clojurescript "1.9.660"]</code></li>
|
||||
<li><code>[org.clojure/clojure "1.9.0-alpha19"]</code></li>
|
||||
<li><code>[clojure-future-spec "1.9.0-alpha17"]</code> (Clojure 1.8)</li>
|
||||
</ul>
|
||||
<h2 id="at-runtime">At runtime</h2>
|
||||
<p>If route trees are generated at runtime (e.g. from external source like the database), one can use directly the <code>clojure.spec</code> functions.</p>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name">require</span> '[clojure.spec.alpha <span class="hljs-symbol">:as</span> s])
|
||||
(<span class="hljs-name">require</span> '[reitit.spec <span class="hljs-symbol">:as</span> spec])
|
||||
|
||||
(<span class="hljs-name"><span class="hljs-builtin-name">def</span></span> routes-from-db
|
||||
[<span class="hljs-string">"tenant1"</span> <span class="hljs-symbol">::tenant1</span>])
|
||||
|
||||
(<span class="hljs-name">s/valid?</span> <span class="hljs-symbol">::spec/raw-routes</span> routes-from-db)
|
||||
<span class="hljs-comment">; false</span>
|
||||
|
||||
(<span class="hljs-name">s/explain</span> <span class="hljs-symbol">::spec/raw-routes</span> routes-from-db)
|
||||
<span class="hljs-comment">; In: [0] val: "tenant1" fails spec: :reitit.spec/path at: [:route :path] predicate: (or (blank? %) (starts-with? % "/"))</span>
|
||||
<span class="hljs-comment">; In: [0] val: "tenant1" fails spec: :reitit.spec/raw-route at: [:routes] predicate: (cat :path :reitit.spec/path :arg (? :reitit.spec/arg) :childs (* (and (nilable :reitit.spec/raw-route))))</span>
|
||||
<span class="hljs-comment">; In: [1] val: :user/tenant1 fails spec: :reitit.spec/raw-route at: [:routes] predicate: (cat :path :reitit.spec/path :arg (? :reitit.spec/arg) :childs (* (and (nilable :reitit.spec/raw-route))))</span>
|
||||
<span class="hljs-comment">; :clojure.spec.alpha/spec :reitit.spec/raw-routes</span>
|
||||
<span class="hljs-comment">; :clojure.spec.alpha/value ["tenant1" :user/tenant1]</span>
|
||||
</code></pre>
|
||||
<h2 id="at-development-time">At development time</h2>
|
||||
<p><code>reitit.core/router</code> can be instrumented and use something like <a href="https://github.com/bhb/expound" target="_blank">expound</a> to pretty-print the spec problems.</p>
|
||||
<p>First add a <code>:dev</code> dependency to:</p>
|
||||
<pre><code class="lang-clj">[expound <span class="hljs-string">"0.3.0"</span>]
|
||||
</code></pre>
|
||||
<p>Some bootstrapping:</p>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name">require</span> '[clojure.spec.test.alpha <span class="hljs-symbol">:as</span> stest])
|
||||
(<span class="hljs-name">require</span> '[expound.alpha <span class="hljs-symbol">:as</span> expound])
|
||||
(<span class="hljs-name">require</span> '[clojure.spec.alpha <span class="hljs-symbol">:as</span> s])
|
||||
(<span class="hljs-name">require</span> '[reitit.spec])
|
||||
|
||||
(<span class="hljs-name">stest/instrument</span> `reitit/router)
|
||||
(<span class="hljs-name"><span class="hljs-builtin-name">set!</span></span> s/*explain-out* expound/printer)
|
||||
</code></pre>
|
||||
<p>And we are ready to go:</p>
|
||||
<pre><code class="lang-clj">
|
||||
(<span class="hljs-name">reitit/router</span>
|
||||
[<span class="hljs-string">"/api"</span>
|
||||
[<span class="hljs-string">"/public"</span>
|
||||
[<span class="hljs-string">"/ping"</span>]
|
||||
[<span class="hljs-string">"pong"</span>]]])
|
||||
|
||||
<span class="hljs-comment">; CompilerException clojure.lang.ExceptionInfo: Call to #'reitit.core/router did not conform to spec:</span>
|
||||
<span class="hljs-comment">;</span>
|
||||
<span class="hljs-comment">; -- Spec failed --------------------</span>
|
||||
<span class="hljs-comment">;</span>
|
||||
<span class="hljs-comment">; Function arguments</span>
|
||||
<span class="hljs-comment">;</span>
|
||||
<span class="hljs-comment">; (["/api" ...])</span>
|
||||
<span class="hljs-comment">; ^^^^^^</span>
|
||||
<span class="hljs-comment">;</span>
|
||||
<span class="hljs-comment">; should satisfy</span>
|
||||
<span class="hljs-comment">;</span>
|
||||
<span class="hljs-comment">; (clojure.spec.alpha/cat</span>
|
||||
<span class="hljs-comment">; :path</span>
|
||||
<span class="hljs-comment">; :reitit.spec/path</span>
|
||||
<span class="hljs-comment">; :arg</span>
|
||||
<span class="hljs-comment">; (clojure.spec.alpha/? :reitit.spec/arg)</span>
|
||||
<span class="hljs-comment">; :childs</span>
|
||||
<span class="hljs-comment">; (clojure.spec.alpha/*</span>
|
||||
<span class="hljs-comment">; (clojure.spec.alpha/and</span>
|
||||
<span class="hljs-comment">; (clojure.spec.alpha/nilable :reitit.spec/raw-route))))</span>
|
||||
<span class="hljs-comment">;</span>
|
||||
<span class="hljs-comment">; or</span>
|
||||
<span class="hljs-comment">;</span>
|
||||
<span class="hljs-comment">; (clojure.spec.alpha/cat</span>
|
||||
<span class="hljs-comment">; :path</span>
|
||||
<span class="hljs-comment">; :reitit.spec/path</span>
|
||||
<span class="hljs-comment">; :arg</span>
|
||||
<span class="hljs-comment">; (clojure.spec.alpha/? :reitit.spec/arg)</span>
|
||||
<span class="hljs-comment">; :childs</span>
|
||||
<span class="hljs-comment">; (clojure.spec.alpha/*</span>
|
||||
<span class="hljs-comment">; (clojure.spec.alpha/and</span>
|
||||
<span class="hljs-comment">; (clojure.spec.alpha/nilable :reitit.spec/raw-route))))</span>
|
||||
<span class="hljs-comment">;</span>
|
||||
<span class="hljs-comment">; -- Relevant specs -------</span>
|
||||
<span class="hljs-comment">;</span>
|
||||
<span class="hljs-comment">; :reitit.spec/raw-route:</span>
|
||||
<span class="hljs-comment">; (clojure.spec.alpha/cat</span>
|
||||
<span class="hljs-comment">; :path</span>
|
||||
<span class="hljs-comment">; :reitit.spec/path</span>
|
||||
<span class="hljs-comment">; :arg</span>
|
||||
<span class="hljs-comment">; (clojure.spec.alpha/? :reitit.spec/arg)</span>
|
||||
<span class="hljs-comment">; :childs</span>
|
||||
<span class="hljs-comment">; (clojure.spec.alpha/*</span>
|
||||
<span class="hljs-comment">; (clojure.spec.alpha/and</span>
|
||||
<span class="hljs-comment">; (clojure.spec.alpha/nilable :reitit.spec/raw-route))))</span>
|
||||
<span class="hljs-comment">; :reitit.spec/raw-routes:</span>
|
||||
<span class="hljs-comment">; (clojure.spec.alpha/or</span>
|
||||
<span class="hljs-comment">; :route</span>
|
||||
<span class="hljs-comment">; :reitit.spec/raw-route</span>
|
||||
<span class="hljs-comment">; :routes</span>
|
||||
<span class="hljs-comment">; (clojure.spec.alpha/coll-of :reitit.spec/raw-route :into []))</span>
|
||||
<span class="hljs-comment">;</span>
|
||||
<span class="hljs-comment">; -- Spec failed --------------------</span>
|
||||
<span class="hljs-comment">;</span>
|
||||
<span class="hljs-comment">; Function arguments</span>
|
||||
<span class="hljs-comment">;</span>
|
||||
<span class="hljs-comment">; ([... [... ... ["pong"]]])</span>
|
||||
<span class="hljs-comment">; ^^^^^^</span>
|
||||
<span class="hljs-comment">;</span>
|
||||
<span class="hljs-comment">; should satisfy</span>
|
||||
<span class="hljs-comment">;</span>
|
||||
<span class="hljs-comment">; (fn</span>
|
||||
<span class="hljs-comment">; [%]</span>
|
||||
<span class="hljs-comment">; (or</span>
|
||||
<span class="hljs-comment">; (clojure.string/blank? %)</span>
|
||||
<span class="hljs-comment">; (clojure.string/starts-with? % "/")))</span>
|
||||
<span class="hljs-comment">;</span>
|
||||
<span class="hljs-comment">; or</span>
|
||||
<span class="hljs-comment">;</span>
|
||||
<span class="hljs-comment">; (fn</span>
|
||||
<span class="hljs-comment">; [%]</span>
|
||||
<span class="hljs-comment">; (or</span>
|
||||
<span class="hljs-comment">; (clojure.string/blank? %)</span>
|
||||
<span class="hljs-comment">; (clojure.string/starts-with? % "/")))</span>
|
||||
<span class="hljs-comment">;</span>
|
||||
<span class="hljs-comment">; -- Relevant specs -------</span>
|
||||
<span class="hljs-comment">;</span>
|
||||
<span class="hljs-comment">; :reitit.spec/path:</span>
|
||||
<span class="hljs-comment">; (clojure.spec.alpha/and</span>
|
||||
<span class="hljs-comment">; clojure.core/string?</span>
|
||||
<span class="hljs-comment">; (clojure.core/fn</span>
|
||||
<span class="hljs-comment">; [%]</span>
|
||||
<span class="hljs-comment">; (clojure.core/or</span>
|
||||
<span class="hljs-comment">; (clojure.string/blank? %)</span>
|
||||
<span class="hljs-comment">; (clojure.string/starts-with? % "/"))))</span>
|
||||
<span class="hljs-comment">; :reitit.spec/raw-route:</span>
|
||||
<span class="hljs-comment">; (clojure.spec.alpha/cat</span>
|
||||
<span class="hljs-comment">; :path</span>
|
||||
<span class="hljs-comment">; :reitit.spec/path</span>
|
||||
<span class="hljs-comment">; :arg</span>
|
||||
<span class="hljs-comment">; (clojure.spec.alpha/? :reitit.spec/arg)</span>
|
||||
<span class="hljs-comment">; :childs</span>
|
||||
<span class="hljs-comment">; (clojure.spec.alpha/*</span>
|
||||
<span class="hljs-comment">; (clojure.spec.alpha/and</span>
|
||||
<span class="hljs-comment">; (clojure.spec.alpha/nilable :reitit.spec/raw-route))))</span>
|
||||
<span class="hljs-comment">; :reitit.spec/raw-routes:</span>
|
||||
<span class="hljs-comment">; (clojure.spec.alpha/or</span>
|
||||
<span class="hljs-comment">; :route</span>
|
||||
<span class="hljs-comment">; :reitit.spec/raw-route</span>
|
||||
<span class="hljs-comment">; :routes</span>
|
||||
<span class="hljs-comment">; (clojure.spec.alpha/coll-of :reitit.spec/raw-route :into []))</span>
|
||||
<span class="hljs-comment">;</span>
|
||||
<span class="hljs-comment">; -------------------------</span>
|
||||
<span class="hljs-comment">; Detected 2 errors</span>
|
||||
</code></pre>
|
||||
<h1 id="validating-route-data">Validating route data</h1>
|
||||
<p><em>TODO</em></p>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
<div class="search-results">
|
||||
<div class="has-results">
|
||||
|
||||
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
|
||||
<ul class="search-results-list"></ul>
|
||||
|
||||
</div>
|
||||
<div class="no-results">
|
||||
|
||||
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<a href="route_conflicts.html" class="navigation navigation-prev " aria-label="Previous page: Route conflicts">
|
||||
<i class="fa fa-angle-left"></i>
|
||||
</a>
|
||||
|
||||
|
||||
<a href="configuring_routers.html" class="navigation navigation-next " aria-label="Next page: Configuring routers">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Route Validation","level":"1.3.2","depth":2,"next":{"title":"Configuring routers","level":"1.3.3","depth":2,"path":"configuring_routers.md","ref":"configuring_routers.md","articles":[]},"previous":{"title":"Route conflicts","level":"1.3.1","depth":2,"path":"route_conflicts.md","ref":"route_conflicts.md","articles":[]},"dir":"ltr"},"config":{"plugins":["editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"github":{"url":"https://github.com/metosin/reitit"},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"route_validation.md","mtime":"2017-10-25T15:00:22.836Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2017-10-25T15:01:14.084Z"},"basePath":".","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
|
||||
<script src="gitbook/gitbook.js"></script>
|
||||
<script src="gitbook/theme.js"></script>
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-editlink/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-github/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-search/search-engine.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-search/search.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-sharing/buttons.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
@ -1,433 +0,0 @@
|
|||
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="" >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>Route conflicts · GitBook</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="description" content="">
|
||||
<meta name="generator" content="GitBook 3.2.3">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/style.css">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta name="HandheldFriendly" content="true"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
|
||||
<link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
|
||||
|
||||
|
||||
<link rel="next" href="../ring.html" />
|
||||
|
||||
|
||||
<link rel="prev" href="route_metadata.html" />
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="book">
|
||||
<div class="book-summary">
|
||||
|
||||
|
||||
<div id="book-search-input" role="search">
|
||||
<input type="text" placeholder="Type to search" />
|
||||
</div>
|
||||
|
||||
|
||||
<nav role="navigation">
|
||||
|
||||
|
||||
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1" data-path="../">
|
||||
|
||||
<a href="../">
|
||||
|
||||
|
||||
Introduction
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
Routing
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.2.1" data-path="route_syntax.html">
|
||||
|
||||
<a href="route_syntax.html">
|
||||
|
||||
|
||||
Route syntax
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.2" data-path="routers.html">
|
||||
|
||||
<a href="routers.html">
|
||||
|
||||
|
||||
Routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.3" data-path="route_metadata.html">
|
||||
|
||||
<a href="route_metadata.html">
|
||||
|
||||
|
||||
Route metadata
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter active" data-level="1.2.4" data-path="route_conflicts.html">
|
||||
|
||||
<a href="route_conflicts.html">
|
||||
|
||||
|
||||
Route conflicts
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3" data-path="../ring.html">
|
||||
|
||||
<a href="../ring.html">
|
||||
|
||||
|
||||
Ring support
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4" data-path="../parameter_coercion.html">
|
||||
|
||||
<a href="../parameter_coercion.html">
|
||||
|
||||
|
||||
Parameter coercion
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5" data-path="../compiling_middleware.html">
|
||||
|
||||
<a href="../compiling_middleware.html">
|
||||
|
||||
|
||||
Compiling middleware
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.6" data-path="../validating.html">
|
||||
|
||||
<a href="../validating.html">
|
||||
|
||||
|
||||
Validating route-trees
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.7" data-path="../configuring_routers.html">
|
||||
|
||||
<a href="../configuring_routers.html">
|
||||
|
||||
|
||||
Configuring routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.8" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
TODO: Merging route-trees
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.9" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
TODO: Swagger & OpenAPI
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.10" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
TODO: Interceptors
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
<li>
|
||||
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
|
||||
Published with GitBook
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="book-body">
|
||||
|
||||
<div class="body-inner">
|
||||
|
||||
|
||||
|
||||
<div class="book-header" role="navigation">
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
<i class="fa fa-circle-o-notch fa-spin"></i>
|
||||
<a href=".." >Route conflicts</a>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="page-wrapper" tabindex="-1" role="main">
|
||||
<div class="page-inner">
|
||||
|
||||
<div id="book-search-results">
|
||||
<div class="search-noresults">
|
||||
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<h2 id="route-conflicts">Route conflicts</h2>
|
||||
<p>Route trees should not have multiple routes that match to a single (request) path. <code>router</code> checks the route tree at creation for conflicts and calls a registered <code>:conflicts</code> option callback with the found conflicts. Default implementation throws <code>ex-info</code> with a descriptive message.</p>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name">reitit/router</span>
|
||||
[[<span class="hljs-string">"/ping"</span>]
|
||||
[<span class="hljs-string">"/:user-id/orders"</span>]
|
||||
[<span class="hljs-string">"/bulk/:bulk-id"</span>]
|
||||
[<span class="hljs-string">"/public/*path"</span>]
|
||||
[<span class="hljs-string">"/:version/status"</span>]])
|
||||
<span class="hljs-comment">; CompilerException clojure.lang.ExceptionInfo: router contains conflicting routes:</span>
|
||||
<span class="hljs-comment">;</span>
|
||||
<span class="hljs-comment">; /:user-id/orders</span>
|
||||
<span class="hljs-comment">; -> /public/*path</span>
|
||||
<span class="hljs-comment">; -> /bulk/:bulk-id</span>
|
||||
<span class="hljs-comment">;</span>
|
||||
<span class="hljs-comment">; /bulk/:bulk-id</span>
|
||||
<span class="hljs-comment">; -> /:version/status</span>
|
||||
<span class="hljs-comment">;</span>
|
||||
<span class="hljs-comment">; /public/*path</span>
|
||||
<span class="hljs-comment">; -> /:version/status</span>
|
||||
<span class="hljs-comment">;</span>
|
||||
</code></pre>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
<div class="search-results">
|
||||
<div class="has-results">
|
||||
|
||||
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
|
||||
<ul class="search-results-list"></ul>
|
||||
|
||||
</div>
|
||||
<div class="no-results">
|
||||
|
||||
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<a href="route_metadata.html" class="navigation navigation-prev " aria-label="Previous page: Route metadata">
|
||||
<i class="fa fa-angle-left"></i>
|
||||
</a>
|
||||
|
||||
|
||||
<a href="../ring.html" class="navigation navigation-next " aria-label="Next page: Ring support">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Route conflicts","level":"1.2.4","depth":2,"next":{"title":"Ring support","level":"1.3","depth":1,"path":"ring.md","ref":"ring.md","articles":[]},"previous":{"title":"Route metadata","level":"1.2.3","depth":2,"path":"routing/route_metadata.md","ref":"routing/route_metadata.md","articles":[]},"dir":"ltr"},"config":{"plugins":["editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"github":{"url":"https://github.com/metosin/reitit"},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"routing/route_conflicts.md","mtime":"2017-09-14T15:08:32.267Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2017-09-14T15:08:59.979Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook.js"></script>
|
||||
<script src="../gitbook/theme.js"></script>
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-editlink/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-github/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-search/search.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
@ -1,455 +0,0 @@
|
|||
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="" >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>Route metadata · GitBook</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="description" content="">
|
||||
<meta name="generator" content="GitBook 3.2.3">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/style.css">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta name="HandheldFriendly" content="true"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
|
||||
<link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
|
||||
|
||||
|
||||
<link rel="next" href="route_conflicts.html" />
|
||||
|
||||
|
||||
<link rel="prev" href="routers.html" />
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="book">
|
||||
<div class="book-summary">
|
||||
|
||||
|
||||
<div id="book-search-input" role="search">
|
||||
<input type="text" placeholder="Type to search" />
|
||||
</div>
|
||||
|
||||
|
||||
<nav role="navigation">
|
||||
|
||||
|
||||
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1" data-path="../">
|
||||
|
||||
<a href="../">
|
||||
|
||||
|
||||
Introduction
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
Routing
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.2.1" data-path="route_syntax.html">
|
||||
|
||||
<a href="route_syntax.html">
|
||||
|
||||
|
||||
Route syntax
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.2" data-path="routers.html">
|
||||
|
||||
<a href="routers.html">
|
||||
|
||||
|
||||
Routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter active" data-level="1.2.3" data-path="route_metadata.html">
|
||||
|
||||
<a href="route_metadata.html">
|
||||
|
||||
|
||||
Route metadata
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.4" data-path="route_conflicts.html">
|
||||
|
||||
<a href="route_conflicts.html">
|
||||
|
||||
|
||||
Route conflicts
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3" data-path="../ring.html">
|
||||
|
||||
<a href="../ring.html">
|
||||
|
||||
|
||||
Ring support
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4" data-path="../parameter_coercion.html">
|
||||
|
||||
<a href="../parameter_coercion.html">
|
||||
|
||||
|
||||
Parameter coercion
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5" data-path="../compiling_middleware.html">
|
||||
|
||||
<a href="../compiling_middleware.html">
|
||||
|
||||
|
||||
Compiling middleware
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.6" data-path="../validating.html">
|
||||
|
||||
<a href="../validating.html">
|
||||
|
||||
|
||||
Validating route-trees
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.7" data-path="../configuring_routers.html">
|
||||
|
||||
<a href="../configuring_routers.html">
|
||||
|
||||
|
||||
Configuring routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.8" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
TODO: Merging route-trees
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.9" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
TODO: Swagger & OpenAPI
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.10" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
TODO: Interceptors
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
<li>
|
||||
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
|
||||
Published with GitBook
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="book-body">
|
||||
|
||||
<div class="body-inner">
|
||||
|
||||
|
||||
|
||||
<div class="book-header" role="navigation">
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
<i class="fa fa-circle-o-notch fa-spin"></i>
|
||||
<a href=".." >Route metadata</a>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="page-wrapper" tabindex="-1" role="main">
|
||||
<div class="page-inner">
|
||||
|
||||
<div id="book-search-results">
|
||||
<div class="search-noresults">
|
||||
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<h1 id="route-meta-data">Route meta-data</h1>
|
||||
<p>Routes can have arbitrary meta-data. For nested routes, the meta-data is accumulated from root towards leafs using <a href="https://github.com/weavejester/meta-merge" target="_blank">meta-merge</a>.</p>
|
||||
<p>A router based on nested route tree:</p>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name"><span class="hljs-builtin-name">def</span></span> router
|
||||
(<span class="hljs-name">reitit/router</span>
|
||||
[<span class="hljs-string">"/api"</span> {<span class="hljs-symbol">:interceptors</span> [<span class="hljs-symbol">::api</span>]}
|
||||
[<span class="hljs-string">"/ping"</span> <span class="hljs-symbol">::ping</span>]
|
||||
[<span class="hljs-string">"/admin"</span> {<span class="hljs-symbol">:roles</span> #{<span class="hljs-symbol">:admin</span>}}
|
||||
[<span class="hljs-string">"/users"</span> <span class="hljs-symbol">::users</span>]
|
||||
[<span class="hljs-string">"/db"</span> {<span class="hljs-symbol">:interceptors</span> [<span class="hljs-symbol">::db</span>]
|
||||
<span class="hljs-symbol">:roles</span> ^<span class="hljs-symbol">:replace</span> #{<span class="hljs-symbol">:db-admin</span>}}
|
||||
[<span class="hljs-string">"/:db"</span> {<span class="hljs-symbol">:parameters</span> {<span class="hljs-symbol">:db</span> String}}
|
||||
[<span class="hljs-string">"/drop"</span> <span class="hljs-symbol">::drop-db</span>]
|
||||
[<span class="hljs-string">"/stats"</span> <span class="hljs-symbol">::db-stats</span>]]]]]))
|
||||
</code></pre>
|
||||
<p>Resolved route tree:</p>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name">reitit/routes</span> router)
|
||||
<span class="hljs-comment">; [["/api/ping" {:interceptors [::api]</span>
|
||||
<span class="hljs-comment">; :name ::ping}]</span>
|
||||
<span class="hljs-comment">; ["/api/admin/users" {:interceptors [::api]</span>
|
||||
<span class="hljs-comment">; :roles #{:admin}</span>
|
||||
<span class="hljs-comment">; :name ::users}]</span>
|
||||
<span class="hljs-comment">; ["/api/admin/db/:db/drop" {:interceptors [::api ::db]</span>
|
||||
<span class="hljs-comment">; :roles #{:db-admin}</span>
|
||||
<span class="hljs-comment">; :parameters {:db String}</span>
|
||||
<span class="hljs-comment">; :name ::drop-db}]</span>
|
||||
<span class="hljs-comment">; ["/api/admin/db/:db/stats" {:interceptors [::api ::db]</span>
|
||||
<span class="hljs-comment">; :roles #{:db-admin}</span>
|
||||
<span class="hljs-comment">; :parameters {:db String}</span>
|
||||
<span class="hljs-comment">; :name ::db-stats}]]</span>
|
||||
</code></pre>
|
||||
<p>Path-based routing:</p>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name">reitit/match-by-path</span> router <span class="hljs-string">"/api/admin/users"</span>)
|
||||
<span class="hljs-comment">; #Match{:template "/api/admin/users"</span>
|
||||
<span class="hljs-comment">; :meta {:interceptors [::api]</span>
|
||||
<span class="hljs-comment">; :roles #{:admin}</span>
|
||||
<span class="hljs-comment">; :name ::users}</span>
|
||||
<span class="hljs-comment">; :result nil</span>
|
||||
<span class="hljs-comment">; :params {}</span>
|
||||
<span class="hljs-comment">; :path "/api/admin/users"}</span>
|
||||
</code></pre>
|
||||
<p>On match, route meta-data is returned and can interpreted by the application.</p>
|
||||
<p>Routers also support meta-data compilation enabling things like fast <a href="https://github.com/ring-clojure/ring" target="_blank">Ring</a> or <a href="http://pedestal.io/" target="_blank">Pedestal</a> -style handlers. Compilation results are found under <code>:result</code> in the match. See <a href="../configuring_routers.html">configuring routers</a> for details.</p>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
<div class="search-results">
|
||||
<div class="has-results">
|
||||
|
||||
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
|
||||
<ul class="search-results-list"></ul>
|
||||
|
||||
</div>
|
||||
<div class="no-results">
|
||||
|
||||
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<a href="routers.html" class="navigation navigation-prev " aria-label="Previous page: Routers">
|
||||
<i class="fa fa-angle-left"></i>
|
||||
</a>
|
||||
|
||||
|
||||
<a href="route_conflicts.html" class="navigation navigation-next " aria-label="Next page: Route conflicts">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Route metadata","level":"1.2.3","depth":2,"next":{"title":"Route conflicts","level":"1.2.4","depth":2,"path":"routing/route_conflicts.md","ref":"routing/route_conflicts.md","articles":[]},"previous":{"title":"Routers","level":"1.2.2","depth":2,"path":"routing/routers.md","ref":"routing/routers.md","articles":[]},"dir":"ltr"},"config":{"plugins":["editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"github":{"url":"https://github.com/metosin/reitit"},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"routing/route_metadata.md","mtime":"2017-09-14T15:08:32.267Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2017-09-14T15:08:59.979Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook.js"></script>
|
||||
<script src="../gitbook/theme.js"></script>
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-editlink/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-github/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-search/search.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
@ -1,435 +0,0 @@
|
|||
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="" >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>Route syntax · GitBook</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="description" content="">
|
||||
<meta name="generator" content="GitBook 3.2.3">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/style.css">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta name="HandheldFriendly" content="true"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
|
||||
<link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
|
||||
|
||||
|
||||
<link rel="next" href="routers.html" />
|
||||
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="book">
|
||||
<div class="book-summary">
|
||||
|
||||
|
||||
<div id="book-search-input" role="search">
|
||||
<input type="text" placeholder="Type to search" />
|
||||
</div>
|
||||
|
||||
|
||||
<nav role="navigation">
|
||||
|
||||
|
||||
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1" data-path="../">
|
||||
|
||||
<a href="../">
|
||||
|
||||
|
||||
Introduction
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
Routing
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter active" data-level="1.2.1" data-path="route_syntax.html">
|
||||
|
||||
<a href="route_syntax.html">
|
||||
|
||||
|
||||
Route syntax
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.2" data-path="routers.html">
|
||||
|
||||
<a href="routers.html">
|
||||
|
||||
|
||||
Routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.3" data-path="route_metadata.html">
|
||||
|
||||
<a href="route_metadata.html">
|
||||
|
||||
|
||||
Route metadata
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.4" data-path="route_conflicts.html">
|
||||
|
||||
<a href="route_conflicts.html">
|
||||
|
||||
|
||||
Route conflicts
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3" data-path="../ring.html">
|
||||
|
||||
<a href="../ring.html">
|
||||
|
||||
|
||||
Ring support
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4" data-path="../parameter_coercion.html">
|
||||
|
||||
<a href="../parameter_coercion.html">
|
||||
|
||||
|
||||
Parameter coercion
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5" data-path="../compiling_middleware.html">
|
||||
|
||||
<a href="../compiling_middleware.html">
|
||||
|
||||
|
||||
Compiling middleware
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.6" data-path="../validating.html">
|
||||
|
||||
<a href="../validating.html">
|
||||
|
||||
|
||||
Validating route-trees
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.7" data-path="../configuring_routers.html">
|
||||
|
||||
<a href="../configuring_routers.html">
|
||||
|
||||
|
||||
Configuring routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.8" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
TODO: Merging route-trees
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.9" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
TODO: Swagger & OpenAPI
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.10" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
TODO: Interceptors
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
<li>
|
||||
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
|
||||
Published with GitBook
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="book-body">
|
||||
|
||||
<div class="body-inner">
|
||||
|
||||
|
||||
|
||||
<div class="book-header" role="navigation">
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
<i class="fa fa-circle-o-notch fa-spin"></i>
|
||||
<a href=".." >Route syntax</a>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="page-wrapper" tabindex="-1" role="main">
|
||||
<div class="page-inner">
|
||||
|
||||
<div id="book-search-results">
|
||||
<div class="search-noresults">
|
||||
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<h1 id="route-syntax">Route Syntax</h1>
|
||||
<p>Routes are defined as vectors, which String path, optional (non-vector) route argument and optional child routes. Routes can be wrapped in vectors.</p>
|
||||
<p>Simple route:</p>
|
||||
<pre><code class="lang-clj">[<span class="hljs-string">"/ping"</span>]
|
||||
</code></pre>
|
||||
<p>Two routes:</p>
|
||||
<pre><code class="lang-clj">[[<span class="hljs-string">"/ping"</span>]
|
||||
[<span class="hljs-string">"/pong"</span>]]
|
||||
</code></pre>
|
||||
<p>Routes with meta-data:</p>
|
||||
<pre><code class="lang-clj">[[<span class="hljs-string">"/ping"</span> <span class="hljs-symbol">::ping</span>]
|
||||
[<span class="hljs-string">"/pong"</span> {<span class="hljs-symbol">:name</span> <span class="hljs-symbol">::pong</span>}]]
|
||||
</code></pre>
|
||||
<p>Routes with path and catch-all parameters:</p>
|
||||
<pre><code class="lang-clj">[[<span class="hljs-string">"/users/:user-id"</span>]
|
||||
[<span class="hljs-string">"/public/*path"</span>]]
|
||||
</code></pre>
|
||||
<p>Nested routes with meta-data:</p>
|
||||
<pre><code class="lang-clj">[<span class="hljs-string">"/api"</span>
|
||||
[<span class="hljs-string">"/admin"</span> {<span class="hljs-symbol">:middleware</span> [<span class="hljs-symbol">::admin</span>]}
|
||||
[<span class="hljs-string">"/user"</span> <span class="hljs-symbol">::user</span>]
|
||||
[<span class="hljs-string">"/db"</span> <span class="hljs-symbol">::db</span>]
|
||||
[<span class="hljs-string">"/ping"</span> <span class="hljs-symbol">::ping</span>]]
|
||||
</code></pre>
|
||||
<p>Same routes flattened:</p>
|
||||
<pre><code class="lang-clj">[[<span class="hljs-string">"/api/admin/user"</span> {<span class="hljs-symbol">:middleware</span> [<span class="hljs-symbol">::admin</span>], <span class="hljs-symbol">:name</span> <span class="hljs-symbol">::user</span>}
|
||||
[<span class="hljs-string">"/api/admin/db"</span> {<span class="hljs-symbol">:middleware</span> [<span class="hljs-symbol">::admin</span>], <span class="hljs-symbol">:name</span> <span class="hljs-symbol">::db</span>}
|
||||
[<span class="hljs-string">"/api/ping"</span> <span class="hljs-symbol">::ping</span>]]
|
||||
</code></pre>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
<div class="search-results">
|
||||
<div class="has-results">
|
||||
|
||||
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
|
||||
<ul class="search-results-list"></ul>
|
||||
|
||||
</div>
|
||||
<div class="no-results">
|
||||
|
||||
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<a href="routers.html" class="navigation navigation-next navigation-unique" aria-label="Next page: Routers">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Route syntax","level":"1.2.1","depth":2,"next":{"title":"Routers","level":"1.2.2","depth":2,"path":"routing/routers.md","ref":"routing/routers.md","articles":[]},"previous":{"title":"Routing","level":"1.2","depth":1,"ref":"","articles":[{"title":"Route syntax","level":"1.2.1","depth":2,"path":"routing/route_syntax.md","ref":"routing/route_syntax.md","articles":[]},{"title":"Routers","level":"1.2.2","depth":2,"path":"routing/routers.md","ref":"routing/routers.md","articles":[]},{"title":"Route metadata","level":"1.2.3","depth":2,"path":"routing/route_metadata.md","ref":"routing/route_metadata.md","articles":[]},{"title":"Route conflicts","level":"1.2.4","depth":2,"path":"routing/route_conflicts.md","ref":"routing/route_conflicts.md","articles":[]}]},"dir":"ltr"},"config":{"plugins":["editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"github":{"url":"https://github.com/metosin/reitit"},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"routing/route_syntax.md","mtime":"2017-09-14T15:08:32.267Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2017-09-14T15:08:59.979Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook.js"></script>
|
||||
<script src="../gitbook/theme.js"></script>
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-editlink/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-github/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-search/search.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
@ -1,471 +0,0 @@
|
|||
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="" >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>Routers · GitBook</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="description" content="">
|
||||
<meta name="generator" content="GitBook 3.2.3">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/style.css">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta name="HandheldFriendly" content="true"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
|
||||
<link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
|
||||
|
||||
|
||||
<link rel="next" href="route_metadata.html" />
|
||||
|
||||
|
||||
<link rel="prev" href="route_syntax.html" />
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="book">
|
||||
<div class="book-summary">
|
||||
|
||||
|
||||
<div id="book-search-input" role="search">
|
||||
<input type="text" placeholder="Type to search" />
|
||||
</div>
|
||||
|
||||
|
||||
<nav role="navigation">
|
||||
|
||||
|
||||
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1" data-path="../">
|
||||
|
||||
<a href="../">
|
||||
|
||||
|
||||
Introduction
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
Routing
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.2.1" data-path="route_syntax.html">
|
||||
|
||||
<a href="route_syntax.html">
|
||||
|
||||
|
||||
Route syntax
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter active" data-level="1.2.2" data-path="routers.html">
|
||||
|
||||
<a href="routers.html">
|
||||
|
||||
|
||||
Routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.3" data-path="route_metadata.html">
|
||||
|
||||
<a href="route_metadata.html">
|
||||
|
||||
|
||||
Route metadata
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.4" data-path="route_conflicts.html">
|
||||
|
||||
<a href="route_conflicts.html">
|
||||
|
||||
|
||||
Route conflicts
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3" data-path="../ring.html">
|
||||
|
||||
<a href="../ring.html">
|
||||
|
||||
|
||||
Ring support
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4" data-path="../parameter_coercion.html">
|
||||
|
||||
<a href="../parameter_coercion.html">
|
||||
|
||||
|
||||
Parameter coercion
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5" data-path="../compiling_middleware.html">
|
||||
|
||||
<a href="../compiling_middleware.html">
|
||||
|
||||
|
||||
Compiling middleware
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.6" data-path="../validating.html">
|
||||
|
||||
<a href="../validating.html">
|
||||
|
||||
|
||||
Validating route-trees
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.7" data-path="../configuring_routers.html">
|
||||
|
||||
<a href="../configuring_routers.html">
|
||||
|
||||
|
||||
Configuring routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.8" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
TODO: Merging route-trees
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.9" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
TODO: Swagger & OpenAPI
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.10" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
TODO: Interceptors
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
<li>
|
||||
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
|
||||
Published with GitBook
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="book-body">
|
||||
|
||||
<div class="body-inner">
|
||||
|
||||
|
||||
|
||||
<div class="book-header" role="navigation">
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
<i class="fa fa-circle-o-notch fa-spin"></i>
|
||||
<a href=".." >Routers</a>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="page-wrapper" tabindex="-1" role="main">
|
||||
<div class="page-inner">
|
||||
|
||||
<div id="book-search-results">
|
||||
<div class="search-noresults">
|
||||
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<h1 id="routers">Routers</h1>
|
||||
<p>For routing, a <code>Router</code> is needed. Reitit ships with several different router implementations: <code>:linear-router</code>, <code>:lookup-router</code> and <code>:mixed-router</code>, based on the awesome <a href="https://github.com/pedestal/pedestal/tree/master/route" target="_blank">Pedestal</a> implementation.</p>
|
||||
<p><code>Router</code> is created with <code>reitit.core/router</code>, which takes routes and optional options map as arguments. The route tree gets expanded, optionally coerced and compiled. Actual <code>Router</code> implementation is selected automatically but can be defined with a <code>:router</code> option. <code>Router</code> support both path- and name-based lookups.</p>
|
||||
<p>Creating a router:</p>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name">require</span> '[reitit.core <span class="hljs-symbol">:as</span> reitit])
|
||||
|
||||
(<span class="hljs-name"><span class="hljs-builtin-name">def</span></span> router
|
||||
(<span class="hljs-name">reitit/router</span>
|
||||
[[<span class="hljs-string">"/api"</span>
|
||||
[<span class="hljs-string">"/ping"</span> <span class="hljs-symbol">::ping</span>]
|
||||
[<span class="hljs-string">"/user/:id"</span> <span class="hljs-symbol">::user</span>]]]))
|
||||
</code></pre>
|
||||
<p><code>:mixed-router</code> is created (both static & wild routes are found):</p>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name">reitit/router-name</span> router)
|
||||
<span class="hljs-comment">; :mixed-router</span>
|
||||
</code></pre>
|
||||
<p>The expanded routes:</p>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name">reitit/routes</span> router)
|
||||
<span class="hljs-comment">; [["/api/ping" {:name :user/ping}]</span>
|
||||
<span class="hljs-comment">; ["/api/user/:id" {:name :user/user}]]</span>
|
||||
</code></pre>
|
||||
<p>Route names:</p>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name">reitit/route-names</span> router)
|
||||
<span class="hljs-comment">; [:user/ping :user/user]</span>
|
||||
</code></pre>
|
||||
<h3 id="path-based-routing">Path-based routing</h3>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name">reitit/match-by-path</span> router <span class="hljs-string">"/hello"</span>)
|
||||
<span class="hljs-comment">; nil</span>
|
||||
|
||||
(<span class="hljs-name">reitit/match-by-path</span> router <span class="hljs-string">"/api/user/1"</span>)
|
||||
<span class="hljs-comment">; #Match{:template "/api/user/:id"</span>
|
||||
<span class="hljs-comment">; :meta {:name :user/user}</span>
|
||||
<span class="hljs-comment">; :path "/api/user/1"</span>
|
||||
<span class="hljs-comment">; :result nil</span>
|
||||
<span class="hljs-comment">; :params {:id "1"}}</span>
|
||||
</code></pre>
|
||||
<h3 id="name-based-reverse-routing">Name-based (reverse) routing</h3>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name">reitit/match-by-name</span> router <span class="hljs-symbol">::user</span>)
|
||||
<span class="hljs-comment">; #PartialMatch{:template "/api/user/:id",</span>
|
||||
<span class="hljs-comment">; :meta {:name :user/user},</span>
|
||||
<span class="hljs-comment">; :result nil,</span>
|
||||
<span class="hljs-comment">; :params nil,</span>
|
||||
<span class="hljs-comment">; :required #{:id}}</span>
|
||||
|
||||
(<span class="hljs-name">reitit/partial-match?</span> (<span class="hljs-name">reitit/match-by-name</span> router <span class="hljs-symbol">::user</span>))
|
||||
<span class="hljs-comment">; true</span>
|
||||
</code></pre>
|
||||
<p>Only a partial match. Let's provide the path-parameters:</p>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name">reitit/match-by-name</span> router <span class="hljs-symbol">::user</span> {<span class="hljs-symbol">:id</span> <span class="hljs-string">"1"</span>})
|
||||
<span class="hljs-comment">; #Match{:template "/api/user/:id"</span>
|
||||
<span class="hljs-comment">; :meta {:name :user/user}</span>
|
||||
<span class="hljs-comment">; :path "/api/user/1"</span>
|
||||
<span class="hljs-comment">; :result nil</span>
|
||||
<span class="hljs-comment">; :params {:id "1"}}</span>
|
||||
</code></pre>
|
||||
<p>There is also a exception throwing version:</p>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name">reitit/match-by-name!</span> router <span class="hljs-symbol">::user</span>)
|
||||
<span class="hljs-comment">; ExceptionInfo missing path-params for route /api/user/:id: #{:id}</span>
|
||||
</code></pre>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
<div class="search-results">
|
||||
<div class="has-results">
|
||||
|
||||
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
|
||||
<ul class="search-results-list"></ul>
|
||||
|
||||
</div>
|
||||
<div class="no-results">
|
||||
|
||||
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<a href="route_syntax.html" class="navigation navigation-prev " aria-label="Previous page: Route syntax">
|
||||
<i class="fa fa-angle-left"></i>
|
||||
</a>
|
||||
|
||||
|
||||
<a href="route_metadata.html" class="navigation navigation-next " aria-label="Next page: Route metadata">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Routers","level":"1.2.2","depth":2,"next":{"title":"Route metadata","level":"1.2.3","depth":2,"path":"routing/route_metadata.md","ref":"routing/route_metadata.md","articles":[]},"previous":{"title":"Route syntax","level":"1.2.1","depth":2,"path":"routing/route_syntax.md","ref":"routing/route_syntax.md","articles":[]},"dir":"ltr"},"config":{"plugins":["editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"github":{"url":"https://github.com/metosin/reitit"},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"routing/routers.md","mtime":"2017-09-14T15:08:32.267Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2017-09-14T15:08:59.979Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook.js"></script>
|
||||
<script src="../gitbook/theme.js"></script>
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-editlink/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-github/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-search/search.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
716
swagger.html
716
swagger.html
|
|
@ -1,716 +0,0 @@
|
|||
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="" >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>Swagger-support · GitBook</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="description" content="">
|
||||
<meta name="generator" content="GitBook 3.2.3">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="gitbook/style.css">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="gitbook/gitbook-plugin-highlight/website.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="gitbook/gitbook-plugin-search/search.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta name="HandheldFriendly" content="true"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
|
||||
<link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">
|
||||
|
||||
|
||||
<link rel="next" href="faq.html" />
|
||||
|
||||
|
||||
<link rel="prev" href="interceptors.html" />
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="book">
|
||||
<div class="book-summary">
|
||||
|
||||
|
||||
<div id="book-search-input" role="search">
|
||||
<input type="text" placeholder="Type to search" />
|
||||
</div>
|
||||
|
||||
|
||||
<nav role="navigation">
|
||||
|
||||
|
||||
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1" data-path="./">
|
||||
|
||||
<a href="./">
|
||||
|
||||
|
||||
Introduction
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2" data-path="basics/">
|
||||
|
||||
<a href="basics/">
|
||||
|
||||
|
||||
Basics
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.2.1" data-path="basics/route_syntax.html">
|
||||
|
||||
<a href="basics/route_syntax.html">
|
||||
|
||||
|
||||
Route Syntax
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.2" data-path="basics/router.html">
|
||||
|
||||
<a href="basics/router.html">
|
||||
|
||||
|
||||
Router
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.3" data-path="basics/path_based_routing.html">
|
||||
|
||||
<a href="basics/path_based_routing.html">
|
||||
|
||||
|
||||
Path-based Routing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.4" data-path="basics/name_based_routing.html">
|
||||
|
||||
<a href="basics/name_based_routing.html">
|
||||
|
||||
|
||||
Name-based Routing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.5" data-path="basics/route_data.html">
|
||||
|
||||
<a href="basics/route_data.html">
|
||||
|
||||
|
||||
Route Data
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.6" data-path="basics/route_data_validation.html">
|
||||
|
||||
<a href="basics/route_data_validation.html">
|
||||
|
||||
|
||||
Route Data Validation
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.7" data-path="basics/route_conflicts.html">
|
||||
|
||||
<a href="basics/route_conflicts.html">
|
||||
|
||||
|
||||
Route Conflicts
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3" data-path="coercion/">
|
||||
|
||||
<a href="coercion/">
|
||||
|
||||
|
||||
Coercion
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.3.1" data-path="coercion/coercion.html">
|
||||
|
||||
<a href="coercion/coercion.html">
|
||||
|
||||
|
||||
Coercion Explained
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.2" data-path="coercion/schema_coercion.html">
|
||||
|
||||
<a href="coercion/schema_coercion.html">
|
||||
|
||||
|
||||
Plumatic Schema
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.3" data-path="coercion/clojure_spec_coercion.html">
|
||||
|
||||
<a href="coercion/clojure_spec_coercion.html">
|
||||
|
||||
|
||||
Clojure.spec
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.4" data-path="coercion/data_spec_coercion.html">
|
||||
|
||||
<a href="coercion/data_spec_coercion.html">
|
||||
|
||||
|
||||
Data-specs
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4" data-path="advanced/">
|
||||
|
||||
<a href="advanced/">
|
||||
|
||||
|
||||
Advanced
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.4.1" data-path="advanced/configuring_routers.html">
|
||||
|
||||
<a href="advanced/configuring_routers.html">
|
||||
|
||||
|
||||
Configuring Routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.2" data-path="advanced/different_routers.html">
|
||||
|
||||
<a href="advanced/different_routers.html">
|
||||
|
||||
|
||||
Different Routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.3" data-path="advanced/route_validation.html">
|
||||
|
||||
<a href="advanced/route_validation.html">
|
||||
|
||||
|
||||
Route Validation
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4.4" data-path="advanced/dev_workflow.html">
|
||||
|
||||
<a href="advanced/dev_workflow.html">
|
||||
|
||||
|
||||
Dev Workflow
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5" data-path="ring/">
|
||||
|
||||
<a href="ring/">
|
||||
|
||||
|
||||
Ring
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.5.1" data-path="ring/ring.html">
|
||||
|
||||
<a href="ring/ring.html">
|
||||
|
||||
|
||||
Ring-router
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.2" data-path="ring/default_handler.html">
|
||||
|
||||
<a href="ring/default_handler.html">
|
||||
|
||||
|
||||
Default handler
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.3" data-path="ring/static.html">
|
||||
|
||||
<a href="ring/static.html">
|
||||
|
||||
|
||||
Static Resources
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.4" data-path="ring/dynamic_extensions.html">
|
||||
|
||||
<a href="ring/dynamic_extensions.html">
|
||||
|
||||
|
||||
Dynamic Extensions
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.5" data-path="ring/data_driven_middleware.html">
|
||||
|
||||
<a href="ring/data_driven_middleware.html">
|
||||
|
||||
|
||||
Data-driven Middleware
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.6" data-path="ring/coercion.html">
|
||||
|
||||
<a href="ring/coercion.html">
|
||||
|
||||
|
||||
Pluggable Coercion
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.7" data-path="ring/route_data_validation.html">
|
||||
|
||||
<a href="ring/route_data_validation.html">
|
||||
|
||||
|
||||
Route Data Validation
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.8" data-path="ring/compiling_middleware.html">
|
||||
|
||||
<a href="ring/compiling_middleware.html">
|
||||
|
||||
|
||||
Compiling Middleware
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.6" data-path="performance.html">
|
||||
|
||||
<a href="performance.html">
|
||||
|
||||
|
||||
Performance
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.7" data-path="interceptors.html">
|
||||
|
||||
<a href="interceptors.html">
|
||||
|
||||
|
||||
Interceptors (WIP)
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter active" data-level="1.8" data-path="swagger.html">
|
||||
|
||||
<a href="swagger.html">
|
||||
|
||||
|
||||
Swagger-support
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.9" data-path="faq.html">
|
||||
|
||||
<a href="faq.html">
|
||||
|
||||
|
||||
FAQ
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
<li>
|
||||
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
|
||||
Published with GitBook
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="book-body">
|
||||
|
||||
<div class="body-inner">
|
||||
|
||||
|
||||
|
||||
<div class="book-header" role="navigation">
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
<i class="fa fa-circle-o-notch fa-spin"></i>
|
||||
<a href="." >Swagger-support</a>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="page-wrapper" tabindex="-1" role="main">
|
||||
<div class="page-inner">
|
||||
|
||||
<div id="book-search-results">
|
||||
<div class="search-noresults">
|
||||
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<h1 id="swagger">Swagger</h1>
|
||||
<p>Reitit supports <a href="https://swagger.io/" target="_blank">Swagger</a> to generate route documentation. Documentation is extracted from existing coercion definitions <code>:parameters</code>, <code>:responses</code> and from a set of new doumentation keys.</p>
|
||||
<h3 id="example">Example</h3>
|
||||
<p>Current <code>reitit-swagger</code> draft (with <code>reitit-ring</code> & data-specs):</p>
|
||||
<pre><code class="lang-clj">(<span class="hljs-name">require</span> '[reitit.ring <span class="hljs-symbol">:as</span> ring])
|
||||
(<span class="hljs-name">require</span> '[reitit.ring.swagger <span class="hljs-symbol">:as</span> swagger])
|
||||
(<span class="hljs-name">require</span> '[reitit.ring.coercion <span class="hljs-symbol">:as</span> rrc])
|
||||
(<span class="hljs-name">require</span> '[reitit.coercion.spec <span class="hljs-symbol">:as</span> spec])
|
||||
|
||||
(<span class="hljs-name"><span class="hljs-builtin-name">def</span></span> app
|
||||
(<span class="hljs-name">ring/ring-handler</span>
|
||||
(<span class="hljs-name">ring/router</span>
|
||||
[<span class="hljs-string">"/api"</span>
|
||||
|
||||
<span class="hljs-comment">;; identify a swagger api</span>
|
||||
<span class="hljs-comment">;; there can be several in a routing tree</span>
|
||||
{<span class="hljs-symbol">:swagger</span> {<span class="hljs-symbol">:id</span> <span class="hljs-symbol">:math</span>}}
|
||||
|
||||
<span class="hljs-comment">;; the (undocumented) swagger spec endpoint</span>
|
||||
[<span class="hljs-string">"/swagger.json"</span>
|
||||
{<span class="hljs-symbol">:get</span> {<span class="hljs-symbol">:no-doc</span> <span class="hljs-literal">true</span>
|
||||
<span class="hljs-symbol">:swagger</span> {<span class="hljs-symbol">:info</span> {<span class="hljs-symbol">:title</span> <span class="hljs-string">"my-api"</span>}}
|
||||
<span class="hljs-symbol">:handler</span> (<span class="hljs-name">swagger/create-swagger-handler</span>)}}]
|
||||
|
||||
<span class="hljs-comment">;; the (undocumented) swagger-ui</span>
|
||||
<span class="hljs-comment">;; [org.webjars/swagger-ui "3.13.4"]</span>
|
||||
[<span class="hljs-string">"/docs/*"</span>
|
||||
{<span class="hljs-symbol">:get</span> {<span class="hljs-symbol">:no-doc</span> <span class="hljs-literal">true</span>
|
||||
<span class="hljs-symbol">:handler</span> (<span class="hljs-name">ring/create-resource-handler</span>
|
||||
{<span class="hljs-symbol">:root</span> <span class="hljs-string">"META-INF/resources/webjars/swagger-ui"</span>})}}]
|
||||
|
||||
[<span class="hljs-string">"/minus"</span>
|
||||
{<span class="hljs-symbol">:get</span> {<span class="hljs-symbol">:summary</span> <span class="hljs-string">"minus"</span>
|
||||
<span class="hljs-symbol">:parameters</span> {<span class="hljs-symbol">:query</span> {<span class="hljs-symbol">:x</span> int?, <span class="hljs-symbol">:y</span> int?}}
|
||||
<span class="hljs-symbol">:responses</span> {<span class="hljs-number">200</span> {<span class="hljs-symbol">:body</span> {<span class="hljs-symbol">:total</span> int?}}}
|
||||
<span class="hljs-symbol">:handler</span> (<span class="hljs-name"><span class="hljs-builtin-name">fn</span></span> [{{{<span class="hljs-symbol">:keys</span> [x y]} <span class="hljs-symbol">:query</span>} <span class="hljs-symbol">:parameters</span>}]
|
||||
{<span class="hljs-symbol">:status</span> <span class="hljs-number">200</span>, <span class="hljs-symbol">:body</span> {<span class="hljs-symbol">:total</span> (<span class="hljs-name"><span class="hljs-builtin-name">-</span></span> x y)}})}}]
|
||||
|
||||
[<span class="hljs-string">"/plus"</span>
|
||||
{<span class="hljs-symbol">:get</span> {<span class="hljs-symbol">:summary</span> <span class="hljs-string">"plus"</span>
|
||||
<span class="hljs-symbol">:parameters</span> {<span class="hljs-symbol">:query</span> {<span class="hljs-symbol">:x</span> int?, <span class="hljs-symbol">:y</span> int?}}
|
||||
<span class="hljs-symbol">:responses</span> {<span class="hljs-number">200</span> {<span class="hljs-symbol">:body</span> {<span class="hljs-symbol">:total</span> int?}}}
|
||||
<span class="hljs-symbol">:handler</span> (<span class="hljs-name"><span class="hljs-builtin-name">fn</span></span> [{{{<span class="hljs-symbol">:keys</span> [x y]} <span class="hljs-symbol">:query</span>} <span class="hljs-symbol">:parameters</span>}]
|
||||
{<span class="hljs-symbol">:status</span> <span class="hljs-number">200</span>, <span class="hljs-symbol">:body</span> {<span class="hljs-symbol">:total</span> (<span class="hljs-name"><span class="hljs-builtin-name">+</span></span> x y)}})}}]]
|
||||
|
||||
{<span class="hljs-symbol">:data</span> {<span class="hljs-symbol">:middleware</span> [rrc/coerce-exceptions-middleware
|
||||
rrc/coerce-request-middleware
|
||||
rrc/coerce-response-middleware
|
||||
<span class="hljs-comment">;; provides just route data specs</span>
|
||||
swagger/swagger-feature]
|
||||
<span class="hljs-symbol">:coercion</span> spec/coercion}})))
|
||||
</code></pre>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
<div class="search-results">
|
||||
<div class="has-results">
|
||||
|
||||
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
|
||||
<ul class="search-results-list"></ul>
|
||||
|
||||
</div>
|
||||
<div class="no-results">
|
||||
|
||||
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<a href="interceptors.html" class="navigation navigation-prev " aria-label="Previous page: Interceptors (WIP)">
|
||||
<i class="fa fa-angle-left"></i>
|
||||
</a>
|
||||
|
||||
|
||||
<a href="faq.html" class="navigation navigation-next " aria-label="Next page: FAQ">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Swagger-support","level":"1.8","depth":1,"next":{"title":"FAQ","level":"1.9","depth":1,"path":"faq.md","ref":"faq.md","articles":[]},"previous":{"title":"Interceptors (WIP)","level":"1.7","depth":1,"path":"interceptors.md","ref":"interceptors.md","articles":[]},"dir":"ltr"},"config":{"plugins":["editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"github":{"url":"https://github.com/metosin/reitit"},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"swagger.md","mtime":"2018-04-29T13:52:12.915Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-04-29T13:52:51.026Z"},"basePath":".","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
|
||||
<script src="gitbook/gitbook.js"></script>
|
||||
<script src="gitbook/theme.js"></script>
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-editlink/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-github/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-search/search-engine.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-search/search.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-sharing/buttons.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
498
validating.html
498
validating.html
|
|
@ -1,498 +0,0 @@
|
|||
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="" >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>Validating route-trees · GitBook</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="description" content="">
|
||||
<meta name="generator" content="GitBook 3.2.3">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="gitbook/style.css">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="gitbook/gitbook-plugin-highlight/website.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="gitbook/gitbook-plugin-search/search.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta name="HandheldFriendly" content="true"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
|
||||
<link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">
|
||||
|
||||
|
||||
<link rel="next" href="configuring_routers.html" />
|
||||
|
||||
|
||||
<link rel="prev" href="compiling_middleware.html" />
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="book">
|
||||
<div class="book-summary">
|
||||
|
||||
|
||||
<div id="book-search-input" role="search">
|
||||
<input type="text" placeholder="Type to search" />
|
||||
</div>
|
||||
|
||||
|
||||
<nav role="navigation">
|
||||
|
||||
|
||||
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1" data-path="./">
|
||||
|
||||
<a href="./">
|
||||
|
||||
|
||||
Introduction
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
Routing
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.2.1" data-path="routing/route_syntax.html">
|
||||
|
||||
<a href="routing/route_syntax.html">
|
||||
|
||||
|
||||
Route syntax
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.2" data-path="routing/routers.html">
|
||||
|
||||
<a href="routing/routers.html">
|
||||
|
||||
|
||||
Routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.3" data-path="routing/route_metadata.html">
|
||||
|
||||
<a href="routing/route_metadata.html">
|
||||
|
||||
|
||||
Route metadata
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.4" data-path="routing/route_conflicts.html">
|
||||
|
||||
<a href="routing/route_conflicts.html">
|
||||
|
||||
|
||||
Route conflicts
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3" data-path="ring.html">
|
||||
|
||||
<a href="ring.html">
|
||||
|
||||
|
||||
Ring support
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4" data-path="parameter_coercion.html">
|
||||
|
||||
<a href="parameter_coercion.html">
|
||||
|
||||
|
||||
Parameter coercion
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5" data-path="compiling_middleware.html">
|
||||
|
||||
<a href="compiling_middleware.html">
|
||||
|
||||
|
||||
Compiling middleware
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter active" data-level="1.6" data-path="validating.html">
|
||||
|
||||
<a href="validating.html">
|
||||
|
||||
|
||||
Validating route-trees
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.7" data-path="configuring_routers.html">
|
||||
|
||||
<a href="configuring_routers.html">
|
||||
|
||||
|
||||
Configuring routers
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.8" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
TODO: Merging route-trees
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.9" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
TODO: Swagger & OpenAPI
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.10" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
TODO: Interceptors
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
<li>
|
||||
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
|
||||
Published with GitBook
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="book-body">
|
||||
|
||||
<div class="body-inner">
|
||||
|
||||
|
||||
|
||||
<div class="book-header" role="navigation">
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
<i class="fa fa-circle-o-notch fa-spin"></i>
|
||||
<a href="." >Validating route-trees</a>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="page-wrapper" tabindex="-1" role="main">
|
||||
<div class="page-inner">
|
||||
|
||||
<div id="book-search-results">
|
||||
<div class="search-noresults">
|
||||
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<h1 id="validating-route-trees">Validating route-trees</h1>
|
||||
<p>Namespace <code>reitit.spec</code> contains <a href="https://clojure.org/about/spec" target="_blank">specs</a> for routes, router and router options.</p>
|
||||
<p>To enable spec-validation of <code>router</code> inputs & outputs at development time, one can do the following:</p>
|
||||
<pre><code class="lang-clj"><span class="hljs-comment">; add to dependencies:</span>
|
||||
<span class="hljs-comment">; [expound "0.3.0"]</span>
|
||||
|
||||
(<span class="hljs-name">require</span> '[clojure.spec.test.alpha <span class="hljs-symbol">:as</span> st])
|
||||
(<span class="hljs-name">require</span> '[expound.alpha <span class="hljs-symbol">:as</span> expound])
|
||||
(<span class="hljs-name">require</span> '[clojure.spec.alpha <span class="hljs-symbol">:as</span> s])
|
||||
(<span class="hljs-name">require</span> '[reitit.spec])
|
||||
|
||||
(<span class="hljs-name">st/instrument</span> `reitit/router)
|
||||
(<span class="hljs-name"><span class="hljs-builtin-name">set!</span></span> s/*explain-out* expound/printer)
|
||||
|
||||
(<span class="hljs-name">reitit/router</span>
|
||||
[<span class="hljs-string">"/api"</span>
|
||||
[<span class="hljs-string">"/publuc"</span>
|
||||
[<span class="hljs-string">"/ping"</span>]
|
||||
[<span class="hljs-string">"pong"</span>]]])
|
||||
<span class="hljs-comment">; -- Spec failed --------------------</span>
|
||||
<span class="hljs-comment">;</span>
|
||||
<span class="hljs-comment">; ["/api" ...]</span>
|
||||
<span class="hljs-comment">; ^^^^^^</span>
|
||||
<span class="hljs-comment">;</span>
|
||||
<span class="hljs-comment">; should satisfy</span>
|
||||
<span class="hljs-comment">;</span>
|
||||
<span class="hljs-comment">; (clojure.spec.alpha/cat</span>
|
||||
<span class="hljs-comment">; :path</span>
|
||||
<span class="hljs-comment">; :reitit.spec/path</span>
|
||||
<span class="hljs-comment">; :arg</span>
|
||||
<span class="hljs-comment">; (clojure.spec.alpha/? :reitit.spec/arg)</span>
|
||||
<span class="hljs-comment">; :childs</span>
|
||||
<span class="hljs-comment">; (clojure.spec.alpha/* (clojure.spec.alpha/and :reitit.spec/raw-route)))</span>
|
||||
<span class="hljs-comment">;</span>
|
||||
<span class="hljs-comment">; -- Relevant specs -------</span>
|
||||
<span class="hljs-comment">;</span>
|
||||
<span class="hljs-comment">; :reitit.spec/raw-route:</span>
|
||||
<span class="hljs-comment">; (clojure.spec.alpha/cat</span>
|
||||
<span class="hljs-comment">; :path</span>
|
||||
<span class="hljs-comment">; :reitit.spec/path</span>
|
||||
<span class="hljs-comment">; :arg</span>
|
||||
<span class="hljs-comment">; (clojure.spec.alpha/? :reitit.spec/arg)</span>
|
||||
<span class="hljs-comment">; :childs</span>
|
||||
<span class="hljs-comment">; (clojure.spec.alpha/* (clojure.spec.alpha/and :reitit.spec/raw-route)))</span>
|
||||
<span class="hljs-comment">; :reitit.spec/raw-routes:</span>
|
||||
<span class="hljs-comment">; (clojure.spec.alpha/or</span>
|
||||
<span class="hljs-comment">; :route</span>
|
||||
<span class="hljs-comment">; :reitit.spec/raw-route</span>
|
||||
<span class="hljs-comment">; :routes</span>
|
||||
<span class="hljs-comment">; (clojure.spec.alpha/coll-of :reitit.spec/raw-route :into []))</span>
|
||||
<span class="hljs-comment">;</span>
|
||||
<span class="hljs-comment">; -- Spec failed --------------------</span>
|
||||
<span class="hljs-comment">;</span>
|
||||
<span class="hljs-comment">; [... [... ... ["pong"]]]</span>
|
||||
<span class="hljs-comment">; ^^^^^^</span>
|
||||
<span class="hljs-comment">;</span>
|
||||
<span class="hljs-comment">; should satisfy</span>
|
||||
<span class="hljs-comment">;</span>
|
||||
<span class="hljs-comment">; (fn [%] (clojure.string/starts-with? % "/"))</span>
|
||||
<span class="hljs-comment">;</span>
|
||||
<span class="hljs-comment">; -- Relevant specs -------</span>
|
||||
<span class="hljs-comment">;</span>
|
||||
<span class="hljs-comment">; :reitit.spec/path:</span>
|
||||
<span class="hljs-comment">; (clojure.spec.alpha/and</span>
|
||||
<span class="hljs-comment">; clojure.core/string?</span>
|
||||
<span class="hljs-comment">; (clojure.core/fn [%] (clojure.string/starts-with? % "/")))</span>
|
||||
<span class="hljs-comment">; :reitit.spec/raw-route:</span>
|
||||
<span class="hljs-comment">; (clojure.spec.alpha/cat</span>
|
||||
<span class="hljs-comment">; :path</span>
|
||||
<span class="hljs-comment">; :reitit.spec/path</span>
|
||||
<span class="hljs-comment">; :arg</span>
|
||||
<span class="hljs-comment">; (clojure.spec.alpha/? :reitit.spec/arg)</span>
|
||||
<span class="hljs-comment">; :childs</span>
|
||||
<span class="hljs-comment">; (clojure.spec.alpha/* (clojure.spec.alpha/and :reitit.spec/raw-route)))</span>
|
||||
<span class="hljs-comment">; :reitit.spec/raw-routes:</span>
|
||||
<span class="hljs-comment">; (clojure.spec.alpha/or</span>
|
||||
<span class="hljs-comment">; :route</span>
|
||||
<span class="hljs-comment">; :reitit.spec/raw-route</span>
|
||||
<span class="hljs-comment">; :routes</span>
|
||||
<span class="hljs-comment">; (clojure.spec.alpha/coll-of :reitit.spec/raw-route :into []))</span>
|
||||
<span class="hljs-comment">;</span>
|
||||
<span class="hljs-comment">; -------------------------</span>
|
||||
<span class="hljs-comment">; Detected 2 errors</span>
|
||||
</code></pre>
|
||||
<h3 id="validating-meta-data">Validating meta-data</h3>
|
||||
<p><em>TODO</em></p>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
<div class="search-results">
|
||||
<div class="has-results">
|
||||
|
||||
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
|
||||
<ul class="search-results-list"></ul>
|
||||
|
||||
</div>
|
||||
<div class="no-results">
|
||||
|
||||
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<a href="compiling_middleware.html" class="navigation navigation-prev " aria-label="Previous page: Compiling middleware">
|
||||
<i class="fa fa-angle-left"></i>
|
||||
</a>
|
||||
|
||||
|
||||
<a href="configuring_routers.html" class="navigation navigation-next " aria-label="Next page: Configuring routers">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Validating route-trees","level":"1.6","depth":1,"next":{"title":"Configuring routers","level":"1.7","depth":1,"path":"configuring_routers.md","ref":"configuring_routers.md","articles":[]},"previous":{"title":"Compiling middleware","level":"1.5","depth":1,"path":"compiling_middleware.md","ref":"compiling_middleware.md","articles":[]},"dir":"ltr"},"config":{"plugins":["editlink","github","highlight"],"root":"doc","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"editlink":{"label":"Edit This Page","multilingual":false,"base":"https://github.com/metosin/reitit/tree/master/doc"},"github":{"url":"https://github.com/metosin/reitit"},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"validating.md","mtime":"2017-09-14T15:08:32.267Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2017-09-14T15:08:59.979Z"},"basePath":".","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
|
||||
<script src="gitbook/gitbook.js"></script>
|
||||
<script src="gitbook/theme.js"></script>
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-editlink/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-github/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-search/search-engine.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-search/search.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-sharing/buttons.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Loading…
Reference in a new issue