-
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathmain.go
32 lines (26 loc) · 733 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
package main
import (
"fmt"
"os"
"github.com/gin-gonic/gin"
config "github.com/micheleriva/gauguin/config"
controller "github.com/micheleriva/gauguin/controller"
)
var router = gin.Default()
func init() {
if config.ConfigError == nil {
router.Static("/public", "./public")
router.StaticFile("/favicon.ico", "./assets/favicon.ico")
router.NoRoute(controller.HandleRoutes)
} else {
cwd, _ := os.Getwd()
fmt.Println("An error occurred while trying to read Gauguin configuration:")
fmt.Println(config.ConfigError)
fmt.Println("We've tried to read the following configuration file:")
fmt.Println(fmt.Sprintf("%s/gauguin.yaml", cwd))
router.NoRoute(controller.ConfigError)
}
}
func main() {
router.Run()
}