{"id":18426397,"url":"https://github.com/complate/complate-http4k","last_synced_at":"2025-07-19T13:10:30.052Z","repository":{"id":94858489,"uuid":"109144325","full_name":"complate/complate-http4k","owner":"complate","description":"complate adapter for HTTP4K toolkit (Kotlin)","archived":false,"fork":false,"pushed_at":"2017-11-14T16:50:44.000Z","size":61,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-02-16T08:26:53.200Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Kotlin","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/complate.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2017-11-01T14:50:54.000Z","updated_at":"2017-11-01T14:52:25.000Z","dependencies_parsed_at":null,"dependency_job_id":"85fcd15a-2aa9-4b48-806b-229f0ea9577f","html_url":"https://github.com/complate/complate-http4k","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/complate%2Fcomplate-http4k","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/complate%2Fcomplate-http4k/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/complate%2Fcomplate-http4k/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/complate%2Fcomplate-http4k/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/complate","download_url":"https://codeload.github.com/complate/complate-http4k/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248766303,"owners_count":21158297,"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-11-06T05:07:50.811Z","updated_at":"2025-04-13T18:54:21.261Z","avatar_url":"https://github.com/complate.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# complate HTTP4K Adapter\n\n[![Build Status](https://travis-ci.org/complate/complate-http4k.svg?branch=master)](https://travis-ci.org/complate/complate-http4k)\n[![codecov](https://codecov.io/gh/complate/complate-http4k/branch/master/graph/badge.svg)](https://codecov.io/gh/complate/complate-http4k)\n[![License](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg)](http://www.apache.org/licenses/LICENSE-2.0.txt)\n\n\nThis adapter connects [HTTP4K](https://http4k.org) with the templating engine [complate](https://github.com/complate). \n\n## Usage\n\n### Compiling and Installation\n\nUnless this library becomes available via maven central (or others), it can be built and installed to the local maven repo:\n\n    ./gradlew clean build\n    ./gradlew install\n\n### Dependency\n\nLibrary import:\n\n```gradle\ndependencies {\n  compile 'com.github.complate:complate-http4k:0.1.1'\n}\n```\n\n### HTTP4K Example\n\nEverything that is required to move an existing _HTTP4K_ based application from another templating engine towards complate\ncan be achieved by switching the templates to `com.github.complate.ComplateTemplates`.\n  \nHere is a more-or-less complete (working) base that shows how to use.\n\n```gradle\ndependencies {\n  // Kotlin\n  compile \"org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version\"\n  \n  // HTTP4K\n  compile \"org.http4k:http4k-core:2.35.1\"\n  compile \"org.http4k:http4k-server-netty:2.35.1\"\n  \n  // complate Adapter\n  compile 'com.github.complate:complate-http4k:0.1.1'\n}\n```\n  \n```kotlin\npackage com.github.complate.http4k.demo\n  \nimport com.github.complate.ComplateTemplates\nimport org.http4k.core.Method\nimport org.http4k.core.Response\nimport org.http4k.core.Status\nimport org.http4k.routing.bind\nimport org.http4k.server.Http4kServer\nimport org.http4k.server.Netty\nimport org.http4k.server.asServer\nimport org.http4k.template.TemplateRenderer\nimport org.http4k.template.ViewModel\nimport kotlin.concurrent.thread\n  \n  \nval bundles = \"src/main/resources/frontend\"\n  \nfun main(args: Array\u003cString\u003e) {\n  val app = DemoApplication()\n  app.start()\n  Runtime.getRuntime().addShutdownHook(thread(start = false) { app.stop() })\n}\n  \ndata class Person(val name: String, val age: Int) : ViewModel\n  \nclass DemoApplication {\n  private val server: Http4kServer\n  private val renderer: TemplateRenderer = ComplateTemplates().HotReload(bundles)\n  \n  private val routes = org.http4k.routing.routes(\n    \"/person\" bind Method.GET to {\n      val viewModel = Person(\"Bob\", 45)\n      val renderedView = renderer(viewModel)\n      Response(Status.OK).body(renderedView)\n    }\n  )\n  \n  init {\n    server = routes.asServer(Netty(9000))\n  }\n  \n  fun start() = server.start()\n    \n  fun stop() = server.stop()\n}\n```\n\n## TODOs\n\nCaching (file \u0026 class path) is not implemented at the moment:\n\n```kotlin\nclass ComplateTemplates : Templates {\n  override fun Caching(baseTemplateDir: String): TemplateRenderer {\n    TODO(\"not implemented\")\n  }\n\n  override fun CachingClasspath(baseClasspathPackage: String): TemplateRenderer {\n    TODO(\"not implemented\")\n  }\n}\n```\n\nThis will hopefully added in a future version of the adapter (most likely v0.2.0).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcomplate%2Fcomplate-http4k","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcomplate%2Fcomplate-http4k","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcomplate%2Fcomplate-http4k/lists"}