mirror of
https://github.com/mgerb/mywebsite
synced 2026-01-11 10:22:53 +00:00
merging back into one repo - not going to host on app engine - google won't allow me to connect to external database
This commit is contained in:
40
server.go
Normal file
40
server.go
Normal file
@@ -0,0 +1,40 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
//local import paths relative to app.yaml file
|
||||
"mywebsite/server/controller/api"
|
||||
"mywebsite/server/db"
|
||||
"mywebsite/server/route"
|
||||
"mywebsite/server/utils"
|
||||
)
|
||||
|
||||
/* for app engine
|
||||
func init() {
|
||||
configurations := utils.ReadConfig()
|
||||
|
||||
db.Configure(configurations.Database)
|
||||
api.Configure(configurations.Api)
|
||||
|
||||
db.Mongo.Connect()
|
||||
|
||||
router := route.Routes()
|
||||
|
||||
http.Handle("/", router)
|
||||
}
|
||||
*/
|
||||
|
||||
func main(){
|
||||
configurations := utils.ReadConfig()
|
||||
|
||||
db.Configure(configurations.Database)
|
||||
api.Configure(configurations.Api)
|
||||
|
||||
db.Mongo.Connect()
|
||||
|
||||
log.Println("Starting Server...")
|
||||
log.Println(http.ListenAndServe(":"+strconv.Itoa(configurations.Port), route.Routes()))
|
||||
}
|
||||
Reference in New Issue
Block a user