liquid_feedback_frontend
view env/request/router.lua @ 1400:e8e4396fd73c
Changed style of register image upload 10
| author | bsw | 
|---|---|
| date | Mon Aug 13 19:37:22 2018 +0200 (2018-08-13) | 
| parents | 32cc544d5a5b | 
| children | 50f5b8a97f91 | 
 line source
     1 local api_endpoints = {
     2   instance = true,
     3   navigation = true,
     4   style = true,
     5   application = true,
     6   info = true,
     7   member = true,
     8   notify_email = true,
     9   profile_info = true,
    10   profile = true,
    11   settings_info = true,
    12   settings = true,
    13   event = true
    14 }
    16 function request.router()
    18   local api_prefix = "api/1/"
    20   local path = request.get_path()
    22   if path == api_prefix .. "register" then
    23     return { module = "oauth2", view = "register" }
    24   elseif path == api_prefix .. "authorization" then
    25     return { module = "oauth2", view = "authorization" }
    26   elseif path == api_prefix .. "token" then
    27     return { module = "oauth2", view = "token" }
    28   elseif path == api_prefix .. "validate" then
    29     return { module = "oauth2", view = "validate" }
    30   elseif path == api_prefix .. "session" then
    31     return { module = "oauth2", view = "session" }
    32   else
    33     local endpoint = string.match(path, "^" .. api_prefix .. "(.*)$")
    34     if api_endpoints[endpoint] then
    35       return { module = "api", view = endpoint }
    36     end
    37   end
    39   return request.default_router(path)
    41 end
