You need to sign in or sign up before continuing.
main.go 449 Bytes
Newer Older
Ai-Sasit's avatar
Ai-Sasit committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
package main

import (
	"fiber-mongo-api/configs"
	"fiber-mongo-api/routes" //add this

	"github.com/gofiber/fiber/v2"
	"github.com/gofiber/fiber/v2/middleware/cors"
)

func main() {
	app := fiber.New()
	app.Use(cors.New(
		cors.Config{
			AllowOrigins: "*",
			AllowHeaders: "Origin, Content-Type, Accept",
		},
	))

	//run database
	configs.ConnectDB()

	//routes
	routes.MenuRoute(app) //add this
	routes.CategoryRoute(app)

	app.Listen(":80")
}