-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
58 lines (43 loc) · 1.13 KB
/
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
49
50
51
52
53
54
55
56
57
58
package main
import (
"app/database"
"app/router"
"fmt"
_ "app/docs"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/logger"
"github.com/gofiber/swagger"
)
// @title Proximi
// @description.markdown api
// @version 1.0
// @termsOfService http://swagger.io/terms/
// @contact.name API Support
// @contact.email harshpareek91@gmail.com
// @license.name Apache 2.0
// @license.url http://www.apache.org/licenses/LICENSE-2.0.html
// @BasePath /
// @securityDefinitions.apikey ApiKeyAuth
// @in header
// @name Authorization
func main() {
// 1. Loading ENVs
// config.ConfigureENV()
// 2. Creating an instance of fiber app
fmt.Println("New Fiber app is instanitiated...")
app := fiber.New()
// 3. Adding middlewares
fmt.Println("Middleware logger registered...")
app.Use(logger.New())
// 4. Opening Database instance, connecting to it
database.ConnectDatabase()
// 5. Migration of database models
// database.Migrate()
// database.SeedDatabase()
// 6. Routes
router.Router(app)
// swagger
app.Get("/docs/*", swagger.HandlerDefault) // default
// listening to the server
app.Listen(":3000")
}