{"id":17195957,"url":"https://github.com/npryce/krouton","last_synced_at":"2025-04-13T20:41:41.342Z","repository":{"id":66560464,"uuid":"52563989","full_name":"npryce/krouton","owner":"npryce","description":"Typesafe, compositional routing and reverse routing for web apps and HTTP microservices","archived":false,"fork":false,"pushed_at":"2020-11-20T08:50:38.000Z","size":360,"stargazers_count":25,"open_issues_count":1,"forks_count":5,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-06T00:43:25.524Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/npryce.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-02-25T23:21:42.000Z","updated_at":"2023-07-25T14:00:30.000Z","dependencies_parsed_at":"2023-02-28T20:15:45.967Z","dependency_job_id":null,"html_url":"https://github.com/npryce/krouton","commit_stats":null,"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/npryce%2Fkrouton","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/npryce%2Fkrouton/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/npryce%2Fkrouton/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/npryce%2Fkrouton/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/npryce","download_url":"https://codeload.github.com/npryce/krouton/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240118332,"owners_count":19750470,"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","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":"2024-10-15T01:51:57.816Z","updated_at":"2025-02-24T02:30:59.305Z","avatar_url":"https://github.com/npryce.png","language":"Kotlin","funding_links":[],"categories":["others"],"sub_categories":[],"readme":"# Krouton\n\n\nTypesafe, compositional routing and reverse routing for [Kotlin](https://kotlinlang.org) web apps and HTTP microservices.\n\n[![Kotlin](https://img.shields.io/badge/kotlin-1.2.51-blue.svg)](http://kotlinlang.org)\n[![Build Status](https://travis-ci.org/npryce/krouton.svg?branch=master)](https://travis-ci.org/npryce/krouton)\n[![Maven Central](https://img.shields.io/maven-central/v/com.natpryce/krouton.svg)](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.natpryce%22%20AND%20a%3A%22krouton%22)\n[![Apache 2.0](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](http//www.apache.org/licenses/LICENSE-2.0)\n\nKrouton provides a routing API for [HTTP4K](https://http4k.org), but the core abstractions can be used with any web server library.\n\n## Examples\n\n * [Routing and reverse routing with HTTP4K](src/test/kotlin/com/natpryce/krouton/example/HttpRoutingExample.kt)\n\n## Principles\n\nType safe routing and reverse routing.\n\nNo reflection, annotations or classpath scanning.\n\nExplicit, type-checked flow of data and control, instead of \"spooky action at a distance\" via reflection, annotations,\nclasspath scanning, passing data in context maps or synthetic HTTP headers, or control flow via exceptions.  \n\nSeparate code that routes and handles requests from definitions of URLs\n\n* URLs defined by constants (immutable objects)\n* Routing policy defined by operations on those constants\n* Routing done by functions/closures/objects that connect Krouton's routing policy API to a web server library.\n\nCompositional: routes are composed from primitive parts and composition operators. User-defined routes can be used in \nexactly the same way as the predefined primitives.\n\nMandatory aspects of a resource locator go in the path\n\nQuery parameters are optional and are interpreted by the resource.\n\n\n## Routing policy operations\n\n* Parsing: `UrlScheme\u003cT\u003e.parse(String) -\u003e T?`\n* Reverse Routing: `UrlScheme\u003cT\u003e.path(T) -\u003e String`\n* Reporting: `UrlScheme\u003cT\u003e.monitoredPath(T)-\u003e String`\n\n## Route composition\n\n* Append: \n    * `UrlScheme\u003cT\u003e + UrlScheme\u003cU\u003e -\u003e UrlScheme\u003cTuple2\u003cT,U\u003e\u003e`\n    * `+` operator supports appending paths for scalars and tuples, forming paths for tuples with up to five elements\n    * `UrlScheme\u003cUnit\u003e + UrlScheme\u003cT\u003e -\u003e UrlScheme\u003cT\u003e`\n    * `UrlScheme\u003cT\u003e + UrlScheme\u003cUnit\u003e -\u003e UrlScheme\u003cT\u003e`\n* Append fixed path element: `UrlScheme\u003cT\u003e + String -\u003e UrlScheme\u003cT\u003e`\n* Restrict: `UrlScheme\u003cT\u003e where ((T)-\u003eBoolean) -\u003e UrlScheme\u003cT\u003e`\n* Project: `UrlScheme\u003cT\u003e asA Projection\u003cT,U\u003e -\u003e UrlScheme\u003cU\u003e`\n\n\n## What's with the version number?\n\nThe version number is {mental}.{major}.{minor}.{patch}.  The last three digits are treated as a\n[semantic version number](https://semver.org).  The first digit is incremented if there is a significant \nchange in the mental model underpinning the library.   A major version of zero always signifies a pre-release version,\nirrespective of the value of the first digit.  The API of pre-release versions may go through significant changes in \nresponse to user feedback before the release of version x.1.0.0.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnpryce%2Fkrouton","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnpryce%2Fkrouton","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnpryce%2Fkrouton/lists"}