-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
45 lines (29 loc) · 783 Bytes
/
main.go
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package main
import (
"golang_restaurant_management/database"
middleware "golang_restaurant_management/middleware"
routes "golang_restaurant_management/routes"
"os"
"github.com/gin-gonic/gin"
"go.mongodb.org/mongo-driver/mongo"
)
var foodCollection *mongo.Collection = database.OpenCollection(database.Client, "food")
func main(){
port := os.Getenv("PORT")
// if port nil, then select port 8000
if port == ""{
port = "8000"
}
// gin router
router := gin.New()
router.Use(gin.Logger())
routes.UserRoutes(router)
router.Use(middleware.Authentication())
routes.FoodRoutes(router)
routes.MenuRoutes(router)
routes.TableRoutes(router)
routes.OrderRoutes(router)
routes.OrderItemsRoutes(router)
routes.InvoiceRoutes(router)
router.Run(":" + port)
}