Mercurial Hosting > luan
annotate src/luan/modules/http/serve.luan @ 1688:5eb985d1411f
'http/serve.luan' now allows overriding port
| author | Fox |
|---|---|
| date | Sat, 11 Jun 2022 21:14:19 +0200 |
| parents | 307e76ccd0d6 |
| children | af22d6c120e4 |
| rev | line source |
|---|---|
| 1688 | 1 local Luan = require "luan:Luan.luan" |
| 2 local error = Luan.error | |
|
693
ca169567ce07
module URIs must now include ".luan"
Franklin Schmidt <fschmidt@gmail.com>
parents:
494
diff
changeset
|
3 local Io = require "luan:Io.luan" |
|
ca169567ce07
module URIs must now include ".luan"
Franklin Schmidt <fschmidt@gmail.com>
parents:
494
diff
changeset
|
4 local Server = require "luan:http/Server.luan" |
| 1688 | 5 local String = require "luan:String.luan" |
| 6 local to_number = String.to_number or error() | |
|
347
612a283b3d14
improve luan/web file names and add serve.luan
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
7 |
| 1688 | 8 local count = #{...} |
| 9 | |
| 10 if count < 1 or count > 2 then | |
| 11 Io.stderr.write "usage: luan luan:http/serve.luan dir port\n" | |
|
347
612a283b3d14
improve luan/web file names and add serve.luan
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
12 return |
|
612a283b3d14
improve luan/web file names and add serve.luan
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
13 end |
|
612a283b3d14
improve luan/web file names and add serve.luan
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
14 |
| 1688 | 15 Server.serve({...}[1],to_number({...}[2])) |
