{"id":16483475,"url":"https://github.com/dbohdan/jimhttp","last_synced_at":"2025-03-16T18:31:43.377Z","repository":{"id":20809140,"uuid":"24094642","full_name":"dbohdan/jimhttp","owner":"dbohdan","description":"A library collection and web microframework","archived":false,"fork":false,"pushed_at":"2024-05-16T16:10:17.000Z","size":244,"stargazers_count":28,"open_issues_count":0,"forks_count":4,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-02-27T12:14:37.851Z","etag":null,"topics":["http","jim-tcl","json","libraries","redis-client","tcl","valkey-client","web-framework"],"latest_commit_sha":null,"homepage":"https://wiki.tcl-lang.org/page/jimhttp","language":"Tcl","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/dbohdan.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":"2014-09-16T10:07:02.000Z","updated_at":"2024-05-16T20:15:43.000Z","dependencies_parsed_at":"2024-05-16T14:37:47.844Z","dependency_job_id":"939724f3-730d-45f6-a1ca-b3f148857b1a","html_url":"https://github.com/dbohdan/jimhttp","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbohdan%2Fjimhttp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbohdan%2Fjimhttp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbohdan%2Fjimhttp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbohdan%2Fjimhttp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dbohdan","download_url":"https://codeload.github.com/dbohdan/jimhttp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243826783,"owners_count":20354220,"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":["http","jim-tcl","json","libraries","redis-client","tcl","valkey-client","web-framework"],"created_at":"2024-10-11T13:14:09.527Z","updated_at":"2025-03-16T18:31:42.427Z","avatar_url":"https://github.com/dbohdan.png","language":"Tcl","readme":"# jimhttp\n\nA collection of standalone libraries and a web microframework prototype for [Jim Tcl](http://jim.tcl-lang.org/).\nMost of the libraries also work in Tcl\u0026nbsp;8.5–9.\nThe libraries implement command-line and proc argument parsing, an HTML DSL, parsing and generating JSON, templates, and persistent storage\npowered by SQLite 3.\nThe web microframework provides a rough implementation of the HTTP/1.1 protocol and a routing DSL.\n\n## Components\n\nThe components listed below work in Tcl 8.5, 8.6, 9.0b2rc2, and Jim Tcl 0.76 and later unless indicated otherwise.\nEach component is versioned separately.\nComponent version numbers follow [semantic versioning](http://semver.org/spec/v2.0.0.html).\nA major version number of zero indicates an unstable API.\n\n| Filename | Function | Version |\n|----------|----------|---------|\n| [arguments.tcl](arguments.tcl) | Command line argument parsing. | 1.0.0 |\n| [example.tcl](example.tcl)\u0026#x200A;\u003csup\u003e1\u003c/sup\u003e | A sample web server that demonstrates the use of the other components. | — |\n| [entities.tcl](entities.tcl) | A dictionary mapping characters to HTML entities. | 1.0.0 |\n| [html.tcl](html.tcl) | A DSL for generating HTML. Requires entities.tcl. | 0.2.1 |\n| [http.tcl](http.tcl)\u0026#x200A;\u003csup\u003e1\u003c/sup\u003e | The titular web microframework. Requires mime.tcl. | 0.15.2 |\n| [json.tcl](json.tcl) | JSON generation with schema support.\u0026#x200A;\u003csup\u003e3\u003c/sup\u003e  JSON parsing.\u0026#x200A;\u003csup\u003e4\u003c/sup\u003e | 3.0.0 |\n| [mime.tcl](mime.tcl) | Rudimentary MIME type detection based on the file extension. | 1.2.0 |\n| [rejim.tcl](rejim.tcl)\u0026#x200A;\u003csup\u003e2\u003c/sup\u003e | A basic RESP2 Redis/Valkey/KeyDB/etc. client. | 0.2.0 |\n| [storage.tcl](storage.tcl)\u0026#x200A;\u003csup\u003e1\u003c/sup\u003e | SQLite persistence of static variables. | 0.2.0 |\n| [template.tcl](template.tcl) | [tmpl_parser](https://wiki.tcl-lang.org/20363) templating. | 1.0.0 |\n| [testing.tcl](testing.tcl) | A test framework with support for tcltest-style constraints. | 0.5.0 |\n| [tests.tcl](tests.tcl) | Tests for the other components.\u0026#x200A;\u003csup\u003e5\u003c/sup\u003e | — |\n\n1\\. Jim Tcl-only.\n\n2\\. Does not support Tcl 8.5.\n\n3\\. Schemas define data shapes. See the example below.\n\n4\\. **Warning:** parsing is fairly slow in general and extremely slow in UTF-8 builds of Jim Tcl.\n    ([Obsolete benchmark](https://wiki.tcl-lang.org/48500).)\n    This can matter to you if you need to decode more than a few dozen kilobytes of JSON at a time.\n    Since version 0.79, Jim Tcl can be built with a fast binary extension for parsing and encoding JSON.\n    The [jq module](https://wiki.tcl-lang.org/11630) is an option for faster JSON parsing in earlier versions.\n    It requires an external binary.\n\n5\\. Only compatible components are tested in Tcl 8 and 9.\n\n## Use examples\n\n### http.tcl\n\n```Tcl\nsource http.tcl\n\n::http::add-handler GET /hello/:name/:town {\n    ::http::respond [::http::make-response \\\n            \"Hello, $routeVars(name) from $routeVars(town)!\"]\n}\n\n::http::start-server 127.0.0.1 8080\n```\n\n### http.tcl and storage.tcl\n\n```Tcl\nsource http.tcl\nsource storage.tcl\n\n::http::add-handler GET /counter-persistent {{counter 0}} {\n    ::storage::restore-statics\n\n    incr counter\n\n    ::storage::persist-statics\n    ::http::respond [::http::make-response $counter]\n}\n\n::storage::init\n::http::start-server 127.0.0.1 8080\n```\n\n### json.tcl\n\n```Tcl\n# This produces the output\n# {\"a\": \"123\", \"b\": 123, \"c\": [123, 456], \"d\": \"true\", \"e\": true}\n\nsource json.tcl\n\nputs [::json::stringify {\n    a 123\n    b 123\n    c {123 456}\n    d true\n    e true\n} 0 {\n    a string\n    c {*element* number}\n    d string\n}]\n```\n\n## Requirements\n\nCompile Jim Tcl 0.76 or later from its Git repository.\nStable releases prior to that (0.75 and earlier) will not work.\nYou will need an SQLite 3 development package\n(`libsqlite3-dev` on Debian and Ubuntu, `libsqlite3x-devel` on Fedora, `sqlite3-devel` on openSUSE Tumbleweed)\nto do this\nand optionally AsciiDoc\n(`asciidoc` on Debian and Ubuntu, Fedora, and openSUSE)\nto generate the documentation (don't use the option `--disable-docs` if you want it).\n\n```sh\ngit clone https://github.com/msteveb/jimtcl.git\n\ncd jimtcl\n./configure --with-ext=\"oo tree binary sqlite3\" --enable-utf8 --ipv6 --disable-docs\nmake\nsudo make install\n```\n\nOnce you have installed Jim Tcl, you can clone this repository and try out the example by running\n\n```sh\ngit clone https://github.com/dbohdan/jimhttp.git\ncd jimhttp\njimsh example.tcl\n```\n\nand then pointing your web browser to \u003chttp://localhost:8080/\u003e.\n\n## License\n\nMIT.\n\n[entities.tcl](entities.tcl)\nis copyright 1998–2000 Ajuba Solutions and copyright 2006 Michael Schlenker.\nIt is distributed under the Tcl license.\nSee the top comment in the file.\n\n`static.jpg` photo by [Steven Lewis](http://notsteve.com/).\nLicense: [CC0](https://creativecommons.org/publicdomain/zero/1.0/).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdbohdan%2Fjimhttp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdbohdan%2Fjimhttp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdbohdan%2Fjimhttp/lists"}