changed param logic & add more routes
This commit is contained in:
38
routes/api/validation/ngword.go
Normal file
38
routes/api/validation/ngword.go
Normal file
@@ -0,0 +1,38 @@
|
||||
package validation
|
||||
|
||||
import (
|
||||
"bdgrp_go/pbutil"
|
||||
"bdgrp_go/routes"
|
||||
"bdgrp_go/utils"
|
||||
"fmt"
|
||||
|
||||
"github.com/gofiber/fiber/v2"
|
||||
)
|
||||
|
||||
func init() {
|
||||
path := routes.PathOf()
|
||||
routes.Register(func(app *fiber.App) {
|
||||
app.Post(path, ngword)
|
||||
fmt.Println("Loaded:", path)
|
||||
})
|
||||
}
|
||||
|
||||
func ngword(c *fiber.Ctx) error {
|
||||
data := map[string]any{
|
||||
"isBadWord": false,
|
||||
}
|
||||
|
||||
encoded, err := pbutil.Encode("NgWordResponse", data)
|
||||
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return c.Status(500).SendString("")
|
||||
}
|
||||
|
||||
encrypted, err := utils.Encrypt(encoded)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
|
||||
return c.Send(encrypted)
|
||||
}
|
||||
Reference in New Issue
Block a user