What | jimhttp (name subject to change) |
Where | https://github.com/dbohdan/jimhttp |
Description | A web microframework prototype meant to be like Sinatra and Flask written in pure Jim Tcl. Provides a rough implementation of the HTTP protocol as well as routing, templates, JSON generation and parsing, an HTML DSL and persistent storage powered by SQLite3. |
Platforms | Likely all supported by Jim Tcl's aio . |
Prerequisites | The latest Jim Tcl from the Git repository . The current stable release (Jim Tcl 0.75) won't do. |
Updated | 09/2014 |
License | MIT |
source http.tcl http::add-handler GET /hello/:name/:town { return [http::make-response \ "Hello, $routeVars(name) from $routeVars(town)!"] } http::start-server 127.0.0.1 8080
ekd123 - 2014-09-30 08:04:39
Will there be a "tclhttp" written in Tcl?
dbohdan 2014-09-30: It's not a goal for me for now (especially since there are already web frameworks for Tcl) but I would welcome a compatibility patch that makes the code work in both. Porting should be pretty straightforward except for the use of static variables (though static variables can be emulated with namespaces, e.g, by mapping variable varName to $procName::$varName).
aspect 2014-10-01: I just spent an hour or so trying to shim this to run under Tcl (as a Jim learning exercise - nothing more), and while I didn't succeed it certainly looks feasible. A jimshim package would have to do a couple of things:
That might be all that's needed. Some (all?) of these are quite trivial edits to the code as it is, but a shim to run it unmodified would be quite nice. Appropriate wrappers for socket and sqlite3 should be trivial in TclOO. If anyone's motivated enough to make a page for Jim Shim and start building a package, I'm happy to contribute what I have so far ... though I have no direct use for it right now, and no real experience with Jim, so quality and support from my end should not be relied upon ;-).
Worth noting: several of jimhttp's modules run perfectly on Tcl without modification. It might be more fun to pull those out and use them with Wibble or Woof! or Rivet or Wub or H . I think that's all the most popular Tcl HTTP stacks today?