mirror of
https://github.com/mgerb/mywebsite
synced 2026-01-10 01:42:55 +00:00
29 lines
545 B
Go
29 lines
545 B
Go
package main
|
|
|
|
import (
|
|
"log"
|
|
"net/http"
|
|
"strconv"
|
|
"github.com/NYTimes/gziphandler"
|
|
|
|
"mywebsite/server/controller/api"
|
|
"mywebsite/server/db"
|
|
"mywebsite/server/route"
|
|
"mywebsite/server/utils"
|
|
)
|
|
|
|
func main(){
|
|
configurations := utils.ReadConfig()
|
|
|
|
db.Configure(configurations.Database)
|
|
api.Configure(configurations.Api)
|
|
|
|
db.Mongo.Connect()
|
|
|
|
//register middleware
|
|
handle := gziphandler.GzipHandler(route.Routes())
|
|
|
|
log.Println("Starting Server...")
|
|
log.Println(http.ListenAndServe(":"+strconv.Itoa(configurations.Port), handle))
|
|
}
|