46 lines
819 B
Go
46 lines
819 B
Go
package main
|
|
|
|
import (
|
|
"gitea.deepak.science/deepak/gogmagog/config"
|
|
"gitea.deepak.science/deepak/gogmagog/db"
|
|
"gitea.deepak.science/deepak/gogmagog/models"
|
|
"log"
|
|
)
|
|
|
|
func main() {
|
|
// Config
|
|
config.Init()
|
|
port := config.Port.GetString()
|
|
env := config.Environment.GetString()
|
|
|
|
log.Print("Running server on " + port)
|
|
log.Print("App environment is " + env)
|
|
|
|
// DB
|
|
store := db.GetStore()
|
|
|
|
if store != nil {
|
|
log.Print("Got DB connection")
|
|
}
|
|
m := models.New(store)
|
|
if m != nil {
|
|
log.Print("created model")
|
|
}
|
|
|
|
acts, acterr := m.Actions()
|
|
if acterr != nil {
|
|
log.Fatal("whoopsies", acterr)
|
|
} else {
|
|
log.Printf("Got %d actions", len(acts))
|
|
for i, act := range acts {
|
|
log.Printf("%d: %v", i, act)
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
// Hello is method here to be testable.
|
|
func Hello() string {
|
|
return "Hello, world!\n"
|
|
}
|