feat: add id parsing

Signed-off-by: Sphericalkat <amolele@gmail.com>
This commit is contained in:
sphericalkat committed 2023-05-28 16:58:11 +05:30
1 parent 665d33d9d3
commit aacabdd54d
4 files changed
+63 -47

No files matched your search

+3 -3
View File
@@ -10,9 +10,9 @@ import (
)
func show(c *fiber.Ctx) error {
postId := c.Params("id", "")
postId := converters.ConvertId(c)
if postId == "" {
return c.Redirect("/")
return c.Status(422).SendString("Invalid post ID")
}
e, err := client.PostData(postId)
@@ -42,5 +42,5 @@ func index(c *fiber.Ctx) error {
func RegisterRoutes(app *fiber.App) {
app.Get("/", index)
app.Get("/:id", show)
app.Get("/*", show)
}