Artifact 97444b21d623511f807acd1e7e955667b8b15c9ffe089f5c997c58f49e461e4f:
- File README.md — part of check-in [8e060c0dec] at 2018-02-07 01:38:51 on branch trunk — Mention the license (2-clause BSD) on the homepage. (user: drh size: 1925)
Wapp - A Web-Application Framework for TCL
1.0 Introduction
Wapp is a new framework for writing web applications in TCL, with the following advantages:
- Very small API surface → Simple to learn and use
- A complete application is contained in a single file
- Resistant to attacks and exploits
- Cross-platform → Works via CGI, SCGI, or using a built-in web server
- Does not require MVC, but can do MVC if desired
- The Wapp framework itself is a single-file TCL script that is "source"-ed, "package require"-ed, or even copy/pasted into the application TCL script
- 2-clause BSD license
2.0 Hello World
Here is a minimal web application written using Wapp:
#!/usr/bin/tclsh package require wapp proc wapp-default {} { wapp-subst {<h1>Hello, World!</h1>\n} } wapp-start $argv
To run this application using the built-in web-server, store the code above in a file (here we use the name "hello.tcl") and do:
tclsh hello.tcl
To run the app using the built-in web-server bound to all TCP addresses and listening on port 8080, use:
tclsh hello.tcl --server 8080
To run the app as an SCGI server listening on port 9001:
tclsh hello.tcl --scgi 9001
To run the application as CGI, make the hello.tcl file executable and move into the appropriate directory of your web server.