{"id":15138483,"url":"https://github.com/termermc/krestx-api","last_synced_at":"2026-01-20T00:01:56.128Z","repository":{"id":127810776,"uuid":"522381654","full_name":"termermc/krestx-api","owner":"termermc","description":"An opinionated Vert.x REST library built with Kotlin and coroutines","archived":false,"fork":false,"pushed_at":"2023-01-07T04:10:11.000Z","size":96,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-06T09:18:38.416Z","etag":null,"topics":["coroutines","kotlin","opinionated","rest","vertx","vertx-web"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/termermc.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":"2022-08-08T02:37:13.000Z","updated_at":"2022-08-11T03:16:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"1638121c-4620-4e61-b0c8-488cf9608754","html_url":"https://github.com/termermc/krestx-api","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/termermc/krestx-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/termermc%2Fkrestx-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/termermc%2Fkrestx-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/termermc%2Fkrestx-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/termermc%2Fkrestx-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/termermc","download_url":"https://codeload.github.com/termermc/krestx-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/termermc%2Fkrestx-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28590676,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T00:01:37.455Z","status":"ssl_error","status_checked_at":"2026-01-19T23:58:17.328Z","response_time":67,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["coroutines","kotlin","opinionated","rest","vertx","vertx-web"],"created_at":"2024-09-26T07:40:18.450Z","updated_at":"2026-01-20T00:01:56.112Z","avatar_url":"https://github.com/termermc.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# krestx-api\nOpinionated Vert.x REST library built with Kotlin and coroutines. API portion.\n\nThis project includes a collection of utils for building REST APIs using Vert.x and Kotlin\n\n# Setup\nYou need Java 8 or higher to use this library.\n\nTo use in your project, include the following in your `build.gradle` file:\n```kotlin\nimplementation(\"net.termer.krestx:krestx-api:\u003ccurrent version\u003e\")\n```\n\nAdditionally, you must add the latest 4.X.X versions of the following Vert.x dependencies:\n\n - vertx-core\n - vertx-web\n - vertx-lang-kotlin\n - vertx-lang-kotlin-coroutines\n\nThe library includes them as compile-only dependencies, so it will not work unless you include them in your own project as implementation dependencies.\nThis is to ensure the Vert.x version this library was built against doesn't interfere with the version you're using in your project.\n\n# Usage\nMost methods in this library are extension methods to provide Kotlin-specific and uniform REST functionality to various `vertx-web` components.\n\n## Router Extensions\nFor example, here is an API request handler for `/api/v1/ping`:\n\n```kotlin\nval apiV1Router = Router.router(vertx)\n    .get(\"/ping\")\n    .apiHandler { apiSuccess(\n        jsonObjectOf(\n            \"time\" to Instant.now().toString()\n\t\t)\n\t) }\n\nappRouter.mountApiRouter(\"v1\", apiV1Router)\n```\n\nFor a default API setup (API info on \"/api\", default error handlers), you can use default API handler methods on a Router:\n\n```kotlin\nval currentApiVersion = \"v2\"\nval supportedApiVersions = arrayOf(\"v1\", \"v2\")\n\nappRouter\n    .defaultApiInfoHandler(currentApiVersion, supportedApiVersions)\n    .defaultApiNotFoundHandler()\n    .defaultApiUnauthorizedHandler()\n    .defaultApiInternalErrorHandler()\n```\n\n## API Responses\nAPI response handlers need to return an instance of a `ApiResponse` implementation, which can either be ApiSuccessResponse or ApiErrorResponse.\nSuccess responses can optionally include additional JSON data. Error responses contain a status code (which should match the HTTP status code), an error of zero or more ApiError objects, which include a computer-readable error name (e.g. \"internal_error\"), a message, and optionally additional JSON data.\n\nA success response (with no data in this case) will look something like this:\n\n```json\n{\n  \"success\": true,\n  \"data\": null\n}\n```\n\nAn error response (with 2 errors containing additional data) will look something like this:\n\n```json\n{\n  \"success\": false,\n  \"statusCode\": 400,\n  \"errors\": [\n    {\n      \"name\": \"missing_param\",\n      \"message\": \"Request body is missing \\\"title\\\" parameter\",\n      \"data\": {\n        \"name\": \"title\",\n        \"location\": \"body\"\n      }\n    },\n    {\n      \"name\": \"missing_param\",\n      \"message\": \"Request body is missing \\\"description\\\" parameter\",\n      \"data\": {\n        \"name\": \"description\",\n        \"location\": \"body\"\n      }\n    }\n  ]\n}\n```\n\n# KDoc, Javadoc\nBoth are available on MavenCentral under the same artifact that was stated at the beginning of the `Usage` section.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftermermc%2Fkrestx-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftermermc%2Fkrestx-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftermermc%2Fkrestx-api/lists"}