33 lines
683 B
Go
33 lines
683 B
Go
package main
|
|
|
|
import (
|
|
"git.ipao.vip/rogeecn/mp-qvyun/pkg/wechat"
|
|
"github.com/gofiber/fiber/v3"
|
|
log "github.com/sirupsen/logrus"
|
|
)
|
|
|
|
func main() {
|
|
wechatClient := wechat.New(
|
|
wechat.WithAppID(WechatAppID),
|
|
wechat.WithAppSecret(WechatAppSecret),
|
|
wechat.WithAESKey(WechatAesKey),
|
|
wechat.WithToken(WechatToken),
|
|
)
|
|
|
|
// create a new fiber server
|
|
app := fiber.New()
|
|
|
|
app.Use(VerifyWechatServer(wechatClient))
|
|
|
|
app.Get("/videos", func(c fiber.Ctx) error {
|
|
log.Infof("GET: %+v", c.Queries())
|
|
log.Infof("POST: %s", c.Body())
|
|
return c.SendString(c.Query("echostr", "Error"))
|
|
})
|
|
|
|
// listen on port 3000
|
|
if err := app.Listen(":3000"); err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
}
|