+api doc, fixed endpoints

This commit is contained in:
2023-03-23 17:02:32 +01:00
parent 0ed15a265d
commit 3fb66e075d
4 changed files with 100 additions and 26 deletions

View File

@@ -56,33 +56,30 @@ func Runserver(conf *cfg.Config, args []string) error {
api := router.Group(conf.ApiPrefix + ApiVersion)
{
// upload
api.Post("/file/", auth, func(c *fiber.Ctx) error {
api.Post("/uploads/", auth, func(c *fiber.Ctx) error {
return FilePut(c, conf, db)
})
// download w/o expire
api.Get("/file/:id/:file", auth, func(c *fiber.Ctx) error {
return FileGet(c, conf, db)
})
api.Get("/file/:id/", auth, func(c *fiber.Ctx) error {
return FileGet(c, conf, db)
})
// remove
api.Delete("/file/:id/", auth, func(c *fiber.Ctx) error {
api.Delete("/uploads/:id/", auth, func(c *fiber.Ctx) error {
err := DeleteUpload(c, conf, db)
return SendResponse(c, "", err)
})
// listing
api.Get("/list/", auth, func(c *fiber.Ctx) error {
api.Get("/uploads", auth, func(c *fiber.Ctx) error {
return List(c, conf, db)
})
// info
// info/describe
api.Get("/upload/:id/", auth, func(c *fiber.Ctx) error {
return Describe(c, conf, db)
})
// download w/o expire
api.Get("/download/:id/", auth, func(c *fiber.Ctx) error {
return FileGet(c, conf, db)
})
}
// public routes