{"id":32191208,"url":"https://github.com/clojurewerkz/route-one","last_synced_at":"2025-10-22T01:35:09.506Z","repository":{"id":2879060,"uuid":"3885332","full_name":"clojurewerkz/route-one","owner":"clojurewerkz","description":"Tiny Clojure library that generates HTTP resource routes (as in Ruby on Rails, Jersey, Django, Sinatra, Flask and similar)","archived":false,"fork":false,"pushed_at":"2016-01-02T02:09:51.000Z","size":58,"stargazers_count":94,"open_issues_count":4,"forks_count":7,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-10-22T01:35:01.967Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/clojurewerkz.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-03-31T12:29:30.000Z","updated_at":"2023-08-31T21:40:11.000Z","dependencies_parsed_at":"2022-08-30T22:02:07.291Z","dependency_job_id":null,"html_url":"https://github.com/clojurewerkz/route-one","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/clojurewerkz/route-one","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clojurewerkz%2Froute-one","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clojurewerkz%2Froute-one/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clojurewerkz%2Froute-one/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clojurewerkz%2Froute-one/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/clojurewerkz","download_url":"https://codeload.github.com/clojurewerkz/route-one/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clojurewerkz%2Froute-one/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280365541,"owners_count":26318383,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-21T02:00:06.614Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-10-22T01:35:07.877Z","updated_at":"2025-10-22T01:35:09.500Z","avatar_url":"https://github.com/clojurewerkz.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# What is Route One\n\nRoute One is a tiny Clojure library that generates HTTP resource routes (as in Ruby on Rails, Jersey, Noir and similar\nmodern Web application frameworks). It is meant to be used in HTTP clients, programs that deliver emails with links,\ntesting environments and so on.\n\nRoute One is intentionally small and has very limited feature scope.\n\n## Maven Artifacts\n\n### The Most Recent Release\n\nWith Leiningen:\n\n    [clojurewerkz/route-one \"1.2.0\"]\n\nWith Maven:\n\n    \u003cdependency\u003e\n      \u003cgroupId\u003eclojurewerkz\u003c/groupId\u003e\n      \u003cartifactId\u003eroute-one\u003c/artifactId\u003e\n      \u003cversion\u003e1.2.0\u003c/version\u003e\n    \u003c/dependency\u003e\n\n\n## Supported Clojure versions\n\nRoute One requires Clojure 1.4+.\n\n\n## Documentation \u0026 Examples\n\nIn order to define a route, you can use `defroute`:\n\n```clj\n(defroute document \"/documents/:document-id\")\n```\n\nAfter defining a route, you get several helper functions to work with the route:\n\n`document-path` builds a relative path with passed params:\n\n```clj\n(document-path :document-id \"123\")\n;; =\u003e \"/documents/123\"\n```\n\n`documents-url` builds an absolute url:\n\n```clj\n(with-base-url \"https://myservice.com\"\n  (document-url :document-id \"123\"))\n;; =\u003e \"https://myservice.com/documents/123\"\n```\n\n`document-template` gives a template that you can use to match the url in Clout/Compojure or any\nother library that uses similar syntax.\n\n```clj\ndocument-template\n;; =\u003e \"/documents/:document-id\"\n```\n\n### Usage examples\n\n\n```clj\n(ns my.app\n  (:require [clojurewerkz.route-one.core :refer :all])\n\n;; define your routes\n(defroute about \"/about\")\n(defroute faq \"/faq\")\n(defroute help \"/help\")\n(defroute documents \"/docs/:title\")\n(defroute category-documents \"/docs/:category/:title\")\n(defroute documents-with-ext \"/docs/:title.:ext\")\n\n;; generate relative paths (by generated fns)\n(documents-path :title \"a-title\") ;; =\u003e \"/docs/a-title\"\n(documents-path :title \"ohai\") ;; =\u003e \"/docs/ohai\"\n\n(path-for \"/docs/:category/:title\" { :category \"greetings\" :title \"ohai\" }) ;; =\u003e \"/docs/greetings/ohai\"\n(path-for \"/docs/:category/:title\" { :category \"greetings\" }) ;; =\u003e IllegalArgumentException, because :title value is missing\n\n(with-base-url \"https://myservice.com\"\n  (url-for \"/docs/title\"  { :title \"ohai\" }) ;; =\u003e \"https://myservice.com/docs/title\"\n  (url-for \"/docs/:title\" { :title \"ohai\" }) ;; =\u003e \"https://myservice.com/docs/ohai\"\n  (url-for \"/docs/:category/:title\" { :category \"greetings\" :title \"ohai\" }) ;; =\u003e \"https://myservice.com/docs/greetings/ohai\"\n  (url-for \"/docs/:category/:title\" { :category \"greetings\" }) ;; =\u003e IllegalArgumentException, because :title value is missing\n)\n\n;; generate relative paths (by generated fns)\n(with-base-url \"https://myservice.com\"\n  (documents-url :title \"a-title\") ;; =\u003e \"https://myservice.com/docs/a-title\"\n  (documents-url :title \"a-title\" :category \"greetings\") ;; =\u003e \"https://myservice.com/docs/greetings/a-title\"\n)\n```\n\n### Compojure\n\nUse your templates with Compojure/Clout (they're not present as a dependency, but we support same path structure):\n\n```clj\n(ns my-app\n  (:require [compojure.core :as compojure]\n            [compojure.route :as route])\n  (:use [clojurewerkz.route-one.core))\n\n(defroute about \"/about\")\n(defroute documents \"/docs/:title\")\n\n(compojure/defroutes main-routes\n  (compojure/GET about-template request (handlers.root/root-page request)) ;; will use /about as a template\n  (compojure/GET documents-template request (handlers.root/documents-page request)) ;; will use /docs/:title as a template\n  (route/not-found \"Page not found\"))\n```\n\nYou can also use our overrides of Compojure functions that allow you to build named routes with Compojure:\n\n```clj\n(ns my-app\n  (:require [compojure.core :as compojure])\n  (:use clojurewerkz.route-one.compojure))\n\n(compojure/defroutes main-routes\n  (GET about \"/about\" request (handlers.root/root-page request)) ;; will use /about as a template\n  (GET documents \"/docs/:title\" request (handlers.root/documents-page request)) ;; will use /docs/:title as a template)\n```\n\nThat will generate `main-routes` in same exact manner Compojure generates them, but will also add helper functions\nfor building urls (`about-path`, `about-url`, `documents-path`, `document-url` and so on). For that, you'll have to\nbring in Compojure as a dependency yourself:\n\n```clj\n[compojure \"1.1.5\"]\n```\n\nDocumentation site for Route One is coming in the future (sorry!). Please see our test suite for more code examples.\n\n## Route One Is a ClojureWerkz Project\n\nRoute One is part of the group of libraries known as ClojureWerkz, together with\n[Cassaforte](http://clojurecassandra.info), [Monger](http://clojuremongodb.info), [Langohr](http://clojurerabbitmq.info), [Elastisch](http://clojureelasticsearch.info), [Quartzite](http://clojurequartz.info), and several others.\n\n\n## Continuous Integration\n\n[![Continuous Integration status](https://secure.travis-ci.org/clojurewerkz/route-one.png)](http://travis-ci.org/clojurewerkz/route-one)\n\nCI is hosted by [travis-ci.org](http://travis-ci.org)\n\n\n## Development\n\nRoute One uses [Leiningen 2](https://github.com/technomancy/leiningen/blob/master/doc/TUTORIAL.md). Make sure you have it installed and then run tests\nagainst all supported Clojure versions using\n\n    lein all test\n\nThen create a branch and make your changes on it. Once you are done with your changes and all tests pass, submit\na pull request on Github.\n\n\n\n## License\n\nCopyright © 2012-2016 Michael S. Klishin, Alex Petrov\n\nDistributed under the Eclipse Public License, the same as Clojure.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclojurewerkz%2Froute-one","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclojurewerkz%2Froute-one","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclojurewerkz%2Froute-one/lists"}