Skip to content

Instantly share code, notes, and snippets.

@mseptiaan
Created February 10, 2022 06:36
Show Gist options
  • Select an option

  • Save mseptiaan/96fdd81865de76d2f572207c51184624 to your computer and use it in GitHub Desktop.

Select an option

Save mseptiaan/96fdd81865de76d2f572207c51184624 to your computer and use it in GitHub Desktop.
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