-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
45 lines (34 loc) · 1.05 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
package main
import (
"log"
"os"
"github.com/joho/godotenv"
"github.com/saim61/tasks_list_go/routes"
_ "github.com/go-sql-driver/mysql"
_ "github.com/saim61/tasks_list_go/docs"
)
// @Title Tasks List Go Documentation API
// @Version 1.0
// @Contact.name Saeem Mehmood
// @Contact.email [email protected]
// @Contact.url https://github.com/saim61
// @SecurityDefinitions.apiKey bearerToken
// @In header
// @Name Authorization
// @Description This is the documentation for your tasks list. It shows all the routes and whatever you can do with this service. Once you create your account, login and click on Authorize button at the top and add your bearer toke. Be sure to add `Bearer` before your token otherwise requests would fail.
// @Host localhost:8080
// @BasePath /api/v1
func main() {
port := os.Getenv("PORT")
if port == "" {
port = ":8080"
} else {
port = ":" + port
}
err := godotenv.Load(".env")
if err != nil {
log.Fatalf("Error loading .env file: %s", err)
}
router := routes.SetupAPIRoutes()
log.Fatal(router.Run(port))
}