You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

45 lines
1.1 KiB

package main
import (
"fmt"
"github.com/aldinokemal/go-whatsapp-web-multidevice/controllers"
"github.com/aldinokemal/go-whatsapp-web-multidevice/services"
"github.com/aldinokemal/go-whatsapp-web-multidevice/utils"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/logger"
"github.com/gofiber/fiber/v2/middleware/recover"
"github.com/gofiber/template/html"
_ "github.com/mattn/go-sqlite3"
)
func main() {
engine := html.New("./views", ".html")
app := fiber.New(fiber.Config{
Views: engine,
})
app.Static("/statics", "./statics")
app.Use(recover.New())
app.Use(logger.New())
db := utils.InitWaDB()
cli := utils.InitWaCLI(db)
// Service
authService := services.NewAuthService(cli)
sendService := services.NewSendService(cli)
// Controller
authController := controllers.NewAuthController(authService)
sendController := controllers.NewSendController(sendService)
authController.Route(app)
sendController.Route(app)
app.Get("/", func(ctx *fiber.Ctx) error {
return ctx.JSON(map[string]interface{}{"Status": "Ok"})
})
err := app.Listen(":3000")
if err != nil {
fmt.Println("Failed to start: ", err.Error())
}
}