diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-05-20 15:22:41 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-05-20 15:22:41 -0400 |
| commit | efb3aae55908cb88f5a9c900d6563603ab792d6a (patch) | |
| tree | ce4293828ab43de4e6440bed0accf871a2d82f94 /examples/http-server | |
| parent | 3d313c5956510a807c2ce7d1ffd9c3bfbb708444 (diff) | |
Add more advanced configuration options to modules.ini and support
automatically downloading and installing from it.
Diffstat (limited to 'examples/http-server')
| -rw-r--r-- | examples/http-server/connection-queue.tm | 2 | ||||
| -rw-r--r-- | examples/http-server/http-server.tm | 8 | ||||
| -rw-r--r-- | examples/http-server/modules.ini | 8 | ||||
| -rwxr-xr-x | examples/http-server/sample-site/random.tm | 2 |
4 files changed, 14 insertions, 6 deletions
diff --git a/examples/http-server/connection-queue.tm b/examples/http-server/connection-queue.tm index 5cf8bb91..c56069e1 100644 --- a/examples/http-server/connection-queue.tm +++ b/examples/http-server/connection-queue.tm @@ -1,4 +1,4 @@ -use pthreads_v1.0 +use pthreads func _assert_success(name:Text, val:Int32; inline) fail("$name() failed!") if val < 0 diff --git a/examples/http-server/http-server.tm b/examples/http-server/http-server.tm index 717aa733..89141c32 100644 --- a/examples/http-server/http-server.tm +++ b/examples/http-server/http-server.tm @@ -9,9 +9,9 @@ use <unistd.h> use <arpa/inet.h> use <err.h> -use commands_v1.0 -use pthreads_v1.0 -use patterns_v1.0 +use commands +use pthreads +use patterns use ./connection-queue.tm @@ -138,7 +138,7 @@ func load_routes(directory:Path -> {Text=RouteEntry}) func main(directory:Path, port=Int32(8080)) say("Serving on port $port") routes := load_routes(directory) - say(" Hosting: $routes") + say("Hosting: $routes") serve(port, func(request:HTTPRequest) if handler := routes[request.path] diff --git a/examples/http-server/modules.ini b/examples/http-server/modules.ini new file mode 100644 index 00000000..171e11d2 --- /dev/null +++ b/examples/http-server/modules.ini @@ -0,0 +1,8 @@ +[pthreads] +version=v1.0 + +[patterns] +version=v1.0 + +[commands] +version=v1.0 diff --git a/examples/http-server/sample-site/random.tm b/examples/http-server/sample-site/random.tm index 75e185b3..153ac2af 100755 --- a/examples/http-server/sample-site/random.tm +++ b/examples/http-server/sample-site/random.tm @@ -1,5 +1,5 @@ #!/bin/env tomo -use random_v1.0 +use random func main() say(" |
