All Projects → metosin → Reitit

metosin / Reitit

Licence: epl-1.0
A fast data-driven router for Clojure/Script

Programming Languages

clojure
4091 projects
clojurescript
191 projects
ring
36 projects

Projects that are alternatives of or similar to Reitit

Faygo
Faygo is a fast and concise Go Web framework that can be used to develop high-performance web app(especially API) with fewer codes. Just define a struct handler, faygo will automatically bind/verify the request parameters and generate the online API doc.
Stars: ✭ 1,557 (+74.55%)
Mutual labels:  swagger, middleware
Full Stack Fastapi Couchbase
Full stack, modern web application generator. Using FastAPI, Couchbase as database, Docker, automatic HTTPS and more.
Stars: ✭ 243 (-72.76%)
Mutual labels:  swagger, frontend
Gin Swagger
gin middleware to automatically generate RESTful API documentation with Swagger 2.0.
Stars: ✭ 2,001 (+124.33%)
Mutual labels:  swagger, middleware
Clevergo
👅 CleverGo is a lightweight, feature rich and high performance HTTP router for Go.
Stars: ✭ 246 (-72.42%)
Mutual labels:  middleware, routing
Swift Web
🕸 A collection of Swift server-side frameworks for handling HTML, CSS, routing and middleware.
Stars: ✭ 415 (-53.48%)
Mutual labels:  middleware, routing
Bhagavadgita
A non-profit initiative to help spread the transcendental wisdom from the Bhagavad Gita to people around the world.
Stars: ✭ 84 (-90.58%)
Mutual labels:  swagger, frontend
Ginrpc
gin auto binding,grpc, and annotated route,gin 注解路由, grpc,自动参数绑定工具
Stars: ✭ 157 (-82.4%)
Mutual labels:  swagger, middleware
Tsed
📐 Ts.ED is a Node.js and TypeScript framework on top of Express to write your application with TypeScript (or ES6). It provides a lot of decorators and guideline to make your code more readable and less error-prone.
Stars: ✭ 1,941 (+117.6%)
Mutual labels:  middleware, swagger
Meiam.system
.NET 5 / .NET Core 3.1 WebAPI + Vue 2.0 + RBAC 企业级前后端分离权限框架
Stars: ✭ 340 (-61.88%)
Mutual labels:  swagger, middleware
Simple Php Router
Simple, fast and yet powerful PHP router that is easy to get integrated and in any project. Heavily inspired by the way Laravel handles routing, with both simplicity and expand-ability in mind.
Stars: ✭ 279 (-68.72%)
Mutual labels:  middleware, routing
Routerify
A lightweight, idiomatic, composable and modular router implementation with middleware support for the Rust HTTP library hyper.rs
Stars: ✭ 173 (-80.61%)
Mutual labels:  middleware, routing
Full Stack Fastapi Postgresql
Full stack, modern web application generator. Using FastAPI, PostgreSQL as database, Docker, automatic HTTPS and more.
Stars: ✭ 7,635 (+755.94%)
Mutual labels:  swagger, frontend
Rayo.js
Micro framework for Node.js
Stars: ✭ 170 (-80.94%)
Mutual labels:  middleware, routing
Go Tgbot
Golang telegram bot API wrapper, session-based router and middleware
Stars: ✭ 90 (-89.91%)
Mutual labels:  swagger, middleware
Redux First Routing
A minimal, framework-agnostic API for accomplishing Redux-first routing.
Stars: ✭ 133 (-85.09%)
Mutual labels:  middleware, routing
Http Router
🎉 Release 2.0 is released! Very fast HTTP router for PHP 7.1+ (incl. PHP8 with attributes) based on PSR-7 and PSR-15 with support for annotations and OpenApi (Swagger)
Stars: ✭ 124 (-86.1%)
Mutual labels:  swagger, middleware
Ataraxy
A data-driven Ring routing and destructuring library
Stars: ✭ 187 (-79.04%)
Mutual labels:  data-driven, routing
Go Bootstrap
Easy way to bootstrap a web server in Go (Routing|Middleware|Https)
Stars: ✭ 27 (-96.97%)
Mutual labels:  middleware, routing
koii
A simple middleware for displaying routes in an express application
Stars: ✭ 73 (-91.82%)
Mutual labels:  middleware, routing
Swagger Express Middleware
Swagger 2.0 middlware and mocks for Express.js
Stars: ✭ 543 (-39.13%)
Mutual labels:  swagger, middleware

reitit Build Status cljdoc badge Slack

A fast data-driven router for Clojure(Script).

Presentations:

Full Documentation

There is #reitit in Clojurians Slack for discussion & help.

Main Modules

Extra modules

Latest version

All main modules bundled:

[metosin/reitit "0.5.12"]

Optionally, the parts can be required separately.

Quick start

(require '[reitit.core :as r])

(def router
  (r/router
    [["/api/ping" ::ping]
     ["/api/orders/:id" ::order]]))

(r/match-by-path router "/api/ping")
; #Match{:template "/api/ping"
;        :data {:name ::ping}
;        :result nil
;        :path-params {}
;        :path "/api/ping"}

(r/match-by-name router ::order {:id 2})
; #Match{:template "/api/orders/:id",
;        :data {:name ::order},
;        :result nil,
;        :path-params {:id 2},
;        :path "/api/orders/2"}

Ring example

A Ring routing app with input & output coercion using data-specs.

(require '[reitit.ring :as ring])
(require '[reitit.coercion.spec])
(require '[reitit.ring.coercion :as rrc])

(def app
  (ring/ring-handler
    (ring/router
      ["/api"
       ["/math" {:get {:parameters {:query {:x int?, :y int?}}
                       :responses {200 {:body {:total pos-int?}}}
                       :handler (fn [{{{:keys [x y]} :query} :parameters}]
                                  {:status 200
                                   :body {:total (+ x y)}})}}]]
      ;; router data affecting all routes
      {:data {:coercion reitit.coercion.spec/coercion
              :middleware [rrc/coerce-exceptions-middleware
                           rrc/coerce-request-middleware
                           rrc/coerce-response-middleware]}})))

Valid request:

(app {:request-method :get
      :uri "/api/math"
      :query-params {:x "1", :y "2"}})
; {:status 200
;  :body {:total 3}}

Invalid request:

(app {:request-method :get
      :uri "/api/math"
      :query-params {:x "1", :y "a"}})
;{:status 400,
; :body {:type :reitit.coercion/request-coercion,
;        :coercion :spec,
;        :spec "(spec-tools.core/spec {:spec (clojure.spec.alpha/keys :req-un [:$spec20745/x :$spec20745/y]), :type :map, :keys #{:y :x}, :keys/req #{:y :x}})",
;        :problems [{:path [:y],
;                    :pred "clojure.core/int?",
;                    :val "a",
;                    :via [:$spec20745/y],
;                    :in [:y]}],
;        :value {:x "1", :y "a"},
;        :in [:request :query-params]}}

More examples

All examples are in https://github.com/metosin/reitit/tree/master/examples

External resources

More info

Check out the full documentation!

Join #reitit channel in Clojurians slack.

Roadmap is mostly written in issues.

Special thanks

License

Copyright © 2017-2021 Metosin Oy

Distributed under the Eclipse Public License, the same as Clojure.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].