srv
HTTP server framework, request/response handling.
Load with: use srv
Quick example
use srv
result = srvli("value", "value")
prn(result)
Functions
Server creation
srvne()
Creates a new instance.
srvli(sv, addr)
Performs the operation. Takes sv, addr.
srvhd(sv, hfn)
Performs the operation. Takes sv, hfn.
srvus(sv, mwfn)
Performs the operation. Takes sv, mwfn.
srvtl(sv, cf, kf)
Performs the operation. Takes sv, cf, kf.
srvmb(sv, b)
Performs the operation. Takes sv, b.
Start / Stop
srvgo(sv)
Performs the operation. Takes sv.
srvdn(sv)
Performs the operation. Takes sv.
srvru(sv)
Runs. Takes sv.
Request parsing
srvpa(raw)
Parses. Takes raw.
reqme(req)
Performs the operation. Takes req.
reqpt(req)
Performs the operation. Takes req.
reqqr(req)
Performs the operation. Takes req.
reqgp(req, n)
Performs the operation. Takes req, n.
srqhd(req, n)
Performs the operation. Takes req, n.
reqbo(req)
Performs the operation. Takes req.
srqjs(req)
Performs the operation. Takes req.
reqck(req, n)
Performs the operation. Takes req, n.
reqfo(req, n)
Formats. Takes req, n.
reqfi(req, n)
Performs the operation. Takes req, n.
reqip(req)
Performs the operation. Takes req.
Response object
resne()
Creates a new instance.
resst(res, c)
Sets a value or starts a process. Takes res, c.
resbd(res, c)
Performs the operation. Takes res, c.
resjn(res, d)
Performs the operation. Takes res, d.
reshtm(res, h)
Performs the operation. Takes res, h.
resad(res, n, v)
Adds an item. Takes res, n, v.
resck(res, n, v, o)
Performs the operation. Takes res, n, v, o.
resdck(res, n)
Performs the operation. Takes res, n.
resrd(res, u, st)
Reads data. Takes res, u, st.
Common status helpers
res404(res)
Performs the operation. Takes res.
res400(res, m)
Performs the operation. Takes res, m.
res401(res)
Performs the operation. Takes res.
res403(res)
Performs the operation. Takes res.
res500(res, m)
Performs the operation. Takes res, m.
resok(d)
Performs the operation. Takes d.
resca(d)
Performs the operation. Takes d.
res204()
Performs the operation.
Static file serving
srvfs(root, pfx)
Performs the operation. Takes root, pfx.
JSON body parser middleware
srvjp()
Performs the operation.
Form parser middleware
srvfp()
Performs the operation.
CORS middleware
srvco(origins, methods, headers)
Connects. Takes origins, methods, headers.
Gzip middleware
srvgz()
Performs the operation.
Request ID middleware
srrid()
Performs the operation.
Rate limit response
res429(res, ra)
Performs the operation. Takes res, ra.
Streaming
srvss(res, ct)
Performs the operation. Takes res, ct.
srvsc(res, d)
Performs the operation. Takes res, d.
srvse(res)
Sets a value. Takes res.
SSE
srvev(res)
Performs the operation. Takes res.
srved(res, event, data, id)
Performs the operation. Takes res, event, data, id.
File upload
reqsa(req, fn, dp)
Performs the operation. Takes req, fn, dp.
Caching headers
resmx(res, secs)
Performs the operation. Takes res, secs.
resnc(res)
Performs the operation. Takes res.
reset(res, etag)
Performs the operation. Takes res, etag.
Conditional request helpers
reqim(req)
Performs the operation. Takes req.
reqnm(req)
Performs the operation. Takes req.
res304(res)
Performs the operation. Takes res.
Range requests
reqra(req)
Performs the operation. Takes req.
res206(res, s, e, total, d)
Performs the operation. Takes res, s, e, total, d.
Request context
reqcx(req)
Performs the operation. Takes req.
reqsc(req, k, v)
Performs the operation. Takes req, k, v.
Content negotiation
reqaj(req)
Performs the operation. Takes req.
reqah(req)
Performs the operation. Takes req.
reqae(req, enc)
Performs the operation. Takes req, enc.
Cookie parsing
reqco(req)
Connects. Takes req.
Query string helpers
reqhp(req, n)
Performs the operation. Takes req, n.
Pagination response
respa(res, items, pg, pp, total)
Parses. Takes res, items, pg, pp, total.
resls(res, items)
Lists items. Takes res, items.
resi(res, item)
Performs the operation. Takes res, item.
reser(res, code, msg, det)
Performs the operation. Takes res, code, msg, det.
Redirect helpers
res301(res, u)
Performs the operation. Takes res, u.
res307(res, u)
Performs the operation. Takes res, u.
HATEOAS links
reslk(res, links)
Performs the operation. Takes res, links.
CORS preflight
respf(ao, am, ah, ma)
Performs the operation. Takes ao, am, ah, ma.
Proxy
reqfw(req, tgt, op)
Performs the operation. Takes req, tgt, op.
reqrp(base)
Performs the operation. Takes base.
Webhooks
webhv(payload, sig, secret)
Performs the operation. Takes payload, sig, secret.
webhs(payload, secret)
Performs the operation. Takes payload, secret.
Polymorphic read/write (be.ilu and similar)
srvre(res, k, v)
Performs the operation. Takes res, k, v.
srvre1(a, b)
Performs the operation. Takes a, b.
srvre2(rq)
Performs the operation. Takes rq.
srvne1(op)
Performs the operation. Takes op.
Notes
- HTTP server - routes, middleware, static files, WebSocket upgrade.