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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1688
5eb985d1411f 'http/serve.luan' now allows overriding port
Fox
parents: 1321
diff changeset
1 local Luan = require "luan:Luan.luan"
5eb985d1411f 'http/serve.luan' now allows overriding port
Fox
parents: 1321
diff changeset
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
5eb985d1411f 'http/serve.luan' now allows overriding port
Fox
parents: 1321
diff changeset
5 local String = require "luan:String.luan"
5eb985d1411f 'http/serve.luan' now allows overriding port
Fox
parents: 1321
diff changeset
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
5eb985d1411f 'http/serve.luan' now allows overriding port
Fox
parents: 1321
diff changeset
8 local count = #{...}
5eb985d1411f 'http/serve.luan' now allows overriding port
Fox
parents: 1321
diff changeset
9
5eb985d1411f 'http/serve.luan' now allows overriding port
Fox
parents: 1321
diff changeset
10 if count < 1 or count > 2 then
5eb985d1411f 'http/serve.luan' now allows overriding port
Fox
parents: 1321
diff changeset
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
5eb985d1411f 'http/serve.luan' now allows overriding port
Fox
parents: 1321
diff changeset
15 Server.serve({...}[1],to_number({...}[2]))