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

34 lines
692 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/cfg"
"oa/libs"
"github.com/veypi/OneBD/rest"
7 months ago
"github.com/veypi/OneBD/rest/middlewares/crud"
)
func Use(r rest.Router) {
r.Set("/*", "OPTIONS", libs.CorsAllowAny)
r.Use(libs.CorsAllowAny)
r.Get("", baseInfo)
7 months ago
cfg.StaticObjs.RegistRouter(r, crud.ArgParser)
// access.Use(r.SubRouter("access"))
// app.Use(r.SubRouter("app"))
// user.Use(r.SubRouter("user"))
// token.Use(r.SubRouter("token"))
cfg.StaticObjs.RegistRouter(r, crud.CRUD)
}
func baseInfo(x *rest.X) (any, error) {
return map[string]any{
"id": cfg.Config.ID,
}, nil
}