Files
gitea/routers/api/bots/bots.go
2022-11-25 17:48:48 +08:00

31 lines
614 B
Go

// Copyright 2022 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package bots
import (
"context"
"net/http"
"code.gitea.io/gitea/modules/web"
"code.gitea.io/gitea/routers/api/bots/grpc"
)
func Routes(_ context.Context, prefix string) *web.Route {
m := web.NewRoute()
for _, fn := range []grpc.RouteFn{
grpc.V1Route,
grpc.V1AlphaRoute,
grpc.HealthRoute,
grpc.PingRoute,
grpc.RunnerRoute,
} {
path, handler := fn()
m.Post(path+"*", http.StripPrefix(prefix, handler).ServeHTTP)
}
return m
}