Created
February 10, 2022 06:36
-
-
Save mseptiaan/96fdd81865de76d2f572207c51184624 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "log" | |
| "net/http" | |
| "github.com/gofiber/fiber/v2" | |
| "github.com/tidwall/gjson" | |
| ) | |
| func main() { | |
| app := fiber.New() | |
| app.Post("/ocr", func(c *fiber.Ctx) error { | |
| request := string(c.Body()) | |
| if gjson.Valid(request) { | |
| return c.JSON(&fiber.Map{"status": "OK"}) | |
| } | |
| return c.Status(http.StatusNotAcceptable).JSON(&fiber.Map{"status": "Request not JSON"}) | |
| }) | |
| log.Fatal(app.Listen(":8000")) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment