You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12 lines
453 B
Lua

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

--- 中间件示例: 为每个请求注入一些通用的变量
local lor = require("lor.index")
return function()
return function(req, res, next)
-- res.locals是一个table, 可以在这里注入一些“全局”变量
-- 这个示例里注入app的名称和版本号 在渲染页面时即可使用
res.locals.app_name = "lor application"
res.locals.app_version = lor.version or ""
next()
end
end