forked from rongfengliang/skipper-prometheus-docker-compose
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.lua
37 lines (35 loc) · 836 Bytes
/
app.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
local uuid = require("uuid")
local json = require("json")
local cuid = require("cuid")
function request(ctx, params)
-- ctx.serve({
-- status_code=302,
-- header={
-- location="http://www.baidu.com/",
-- },
-- })
ctx.request.header["user_token"]="request_token"
end
function response(ctx, params)
ctx.response.header["lua_token"]="dalongdemo";
-- local user = {
-- name="dalong",
-- age=33
-- }
local id = cuid.generate ( )
local slug = cuid.slug ( )
local tokeninfo = {
token=uuid(),
status=200,
id=id,
slug=slug
}
ctx.serve({
status_code=200,
header= {
['Content-Type']="application/json",
lua_token=uuid()
},
body=json.encode(tokeninfo)
})
end