-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
48 lines (37 loc) · 882 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
43
44
45
46
47
48
package main
import (
"net/http"
"os"
"github.com/Aanu1995/restaurant-management/routes"
"github.com/gin-gonic/gin"
)
func main(){
// get the port number from environment variable
port := os.Getenv("PORT")
if port == "" {
port = "3000"
}
router := gin.Default()
// Group all API routes
apiRouter := router.Group("/api")
// Authentication routes
routes.AuthRouter(apiRouter)
// User routes
routes.UserRouter(apiRouter)
// User routes
routes.FoodRouter(apiRouter)
// Invoice routes
routes.InvoiceRouter(apiRouter)
// Menu routes
routes.MenuRouter(apiRouter)
// Order routes
routes.OrderRouter(apiRouter)
// Table routes
routes.TableRouter(apiRouter)
// Table routes
routes.OrderItemRouter(apiRouter)
apiRouter.GET("", func(ctx *gin.Context) {
ctx.JSON(http.StatusOK, gin.H{"message":"Welcome to API version 1"})
})
router.Run(":" + port)
}