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.
OneAuth/oa/api/init.go

37 lines
649 B
Go

//
// Copyright (C) 2024 veypi <i@veypi.com>
// 2024-09-20 16:10:16
// Distributed under terms of the MIT license.
//
package api
import (
"oa/api/access"
"oa/api/app"
"oa/api/role"
"oa/api/token"
"oa/api/user"
"oa/cfg"
"oa/libs"
"github.com/veypi/OneBD/rest"
)
func Use(r rest.Router) {
r.Set("/*", "OPTIONS", libs.CorsAllowAny)
r.Use(libs.CorsAllowAny)
access.Use(r.SubRouter("access"))
app.Use(r.SubRouter("app"))
role.Use(r.SubRouter("role"))
user.Use(r.SubRouter("user"))
token.Use(r.SubRouter("token"))
r.Get("", baseInfo)
}
func baseInfo(x *rest.X) (any, error) {
return map[string]any{
"id": cfg.Config.ID,
}, nil
}