Tänzer:适用于 Tcl 的可爱 Web 服务器框架
tänzer 是一个极简的 Tcl Web 服务器框架,旨在简化 HTTP/1.1 Web 应用程序的开发。它提供异步 HTTP/1.1 服务器、基于模式的路由、SCGI 和 CGI 支持、快速静态文件服务等特性,并支持 Tcl 8.6。tänzer 简化了 keepalive 请求、HTTP 消息解析等复杂过程,让开发者能快速构建 Web 服务,例如“Hello, world!”。文章提供了代码示例,展示了如何快速使用 tänzer 搭建 Web 服务。
什么是 tänzer?
tänzer 是一个极简的 Tcl Web 服务器框架,为编写 HTTP/1.1 Web 应用程序提供了一个非常直接的环境。tänzer 正在开发中。
特性
- 异步 HTTP/1.1 Web 服务器
- 基于模式的请求路由引擎
- SCGI 客户端和服务器支持
- CGI 可执行文件支持
- 快速静态文件服务
- 开箱即用,支持 Tcl 8.6
编写异步 Web 应用程序不应该很复杂。幸运的是,tänzer 将带您踏上一段舞蹈之旅,穿越 keepalive 请求、HTTP 消息解析以及 SCGI 和 CGI 支持的重重难关。 使用 tänzer 编写 “Hello, world!” 简直易如反掌! 您想做的其他任何事情也是如此。 今天就用 tänzer 编写您的应用程序吧。
瞬间从零到 Web 服务!
~$ git clone [http://tanzer.io/git/tanzer.git](https://tanzer.io/</git/tanzer.git>)
package require tanzer set server [::tanzer::server new] $server route GET /* {.*:8080} apply { {event session args} { if {$event ne "write"} { return } $session response -new [::tanzer::response new 200 { Content-Type "text/plain" X-Foo "bar" }] $session response buffer "Hello, world!" $session respond $session nextRequest } } $server listen 8080
不要让另一个框架阻碍您。
Copyright (c) 2014 XANTRONIX Development. 在 MIT license 条款下发布。Logo (c) Leese Johnstone.