Compile to non-linear routing strategies
还没有人认领这个 Issue。
评估
调研方向
未指定文件或测试。首先跟踪 context 和 HTTP 动词端点宏,然后检查它们如何展开为 Compojure 路由,以及分离的端点函数如何处理。完成标准是支持更高效的非线性路由策略,包括 HTTP 动词路由,同时不丢失直接 context 之外的路由。
由索引模型根据 Issue 内容生成。
描述
These will probably have to be different than reitit's since route conflicts are idiomatic. We'll probably want more types of routing between trie and linear.
I think routing based on HTTP verb is a good start;
e.g.,
(context "/foo" []
(GET "/bar" [] (ok 1))
(POST "/bar" [] (ok 1))
(PUT "/bar" [] (ok 1))
(PATCH "/bar" [] (ok 1)))
=>
(context "/foo" req
(case (get-http-verb req)
:GET (GET "/bar" [] (ok 1))
:POST (POST "/bar" [] (ok 1))
:PUT (PUT "/bar" [] (ok 1))
:PATCH (PATCH "/bar" [] (ok 1))))
This could probably be achieved at runtime by reifying some of the structure of a route macro at runtime.
Maybe a static context can communicate to its endpoints to return a data representation of themselves instead of expanding to compojure and the static context can compile a more efficient router.
This could be accomplished more dynamically by having context bind a dynamic variable and expanding endpoints to code that checks for this variable to decide whether to return a data representation or a compojure route.
This has the advantage over static transformation under a context of working even if the endpoint is not directly under the context (say, separated by a function call).
- 主要语言
- Clojure
- 星标
- 1.1k
- 派生
- 144
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
metosin/compojure-api 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 45/100
metosin/compojure-api#489 ·
-
难度 5/5 一周以上 新手友好度 30/100
metosin/compojure-api#468 ·
-
难度 5/5 一周以上 新手友好度 25/100
metosin/compojure-api#464 ·
-
难度 5/5 一周以上 新手友好度 30/100
metosin/compojure-api#463 · 3 条评论 ·
-
难度 5/5 一周以上 新手友好度 25/100
metosin/compojure-api#462 · 3 条评论 ·
查看 metosin/compojure-api 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
calcit-lang/calcit#2075 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复
-
.Needs Triage .Team/Gadget Priority:P3 Type:Bug
难度 2/5 1-3 小时 新手友好度 85/100
metabase/metabase#84431 · 1 条评论 ·
维护者通常 1 天内回复
-
needs triage
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复
-
module:db module:terminology-service-local refactoring
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复