feat: add global proxy config upgrade: upgrade front(angular) to 19 chore: deployment staff 1. Dockerfile: build frontend, backend, and run in nginx base image
38 lines
733 B
Go
38 lines
733 B
Go
package api
|
|
|
|
import (
|
|
"context"
|
|
|
|
"nf-repo/internal/handler"
|
|
"nf-repo/internal/interfaces"
|
|
"nf-repo/internal/opt"
|
|
|
|
"github.com/loveuer/nf"
|
|
)
|
|
|
|
func NewApi(
|
|
ctx context.Context,
|
|
bh interfaces.BlobHandler,
|
|
uh interfaces.UploadHandler,
|
|
mh interfaces.ManifestHandler,
|
|
) *nf.App {
|
|
app := nf.New(nf.Config{BodyLimit: opt.DefaultMaxSize})
|
|
|
|
{
|
|
api := app.Group("/v2")
|
|
api.Any("/*path", handler.Root(bh, uh, mh))
|
|
}
|
|
|
|
{
|
|
api := app.Group("/_api/repo")
|
|
api.Get("/settings", handler.RepoSettings)
|
|
api.Get("/list", handler.RepoList(mh))
|
|
api.Get("/tag/list", handler.TagList(mh))
|
|
api.Post("/proxy", handler.ProxyDownloadImage(mh, bh))
|
|
}
|
|
|
|
// app.Use(front.NewFront(&front.DefaultFront, "dist/front/browser"))
|
|
|
|
return app
|
|
}
|