keyctl/pkg/api/v1/server/routes.go
2023-03-23 00:08:33 +01:00

53 lines
1,018 B
Go

// Copyright (C) 2023 Marius Schellenberger
package server
import (
"git.giftfish.de/ston1th/keyctl/pkg/api/types"
"git.giftfish.de/ston1th/keyctl/pkg/api/v1/schema"
"git.giftfish.de/ston1th/keyctl/pkg/core"
)
const (
keyID = schema.KeyPath + core.IDRoute
keyReqID = schema.KeyPath + core.IDRoute + core.AIDRoute
reqID = schema.ReqPath + core.IDRoute
)
var Routes = []types.Route{
{
Path: schema.KeyPath,
Handler: local(keyListHandler),
Methods: []string{"GET"},
},
{
Path: schema.KeyPath,
Handler: local(newHandler),
Methods: []string{"POST"},
},
{
Path: keyID,
Handler: keyHandler,
Methods: []string{"GET"},
},
{
Path: keyReqID,
Handler: keyHandler,
Methods: []string{"GET"},
},
{
Path: keyID,
Handler: local(keyHandler),
Methods: []string{"DELETE"},
},
{
Path: schema.ReqPath,
Handler: local(reqListHandler),
Methods: []string{"GET"},
},
{
Path: reqID,
Handler: local(reqHandler),
Methods: []string{"PUT", "DELETE"},
},
}