feat: init
This commit is contained in:
32
main.go
Normal file
32
main.go
Normal file
@@ -0,0 +1,32 @@
|
||||
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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user