-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
42 lines (36 loc) · 988 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
33
34
35
36
37
38
39
40
41
42
package main
/*
* tiuku API
*
* Access the Tiuku system.
*
* API version: 1.0
* Contact: asko.mattila@gmail.com
* Routing Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
import (
"log"
"net/http"
sw "github.com/AskoTJM/tiuku/api"
"github.com/AskoTJM/tiuku/api/database"
)
func main() {
log.Printf("Server started")
router := sw.NewRouter()
log.Fatal(http.ListenAndServe(":8080", router))
// Check to see if we have required tables.
// ToDo: Decide how to react, create them or just complain.
resCheck := database.CheckIfRequiredTablesExist()
if !resCheck {
log.Printf("No required tables found, make sure to create them before use")
}
//database.ConnectToDB()
/*
Tiukudb, err := gorm.Open("mysql", "apiaccess:apipass@tcp(db:3306)/tiukuDB?charset=utf8mb4")
if err != nil {
log.Printf("Problem with connecting to database. <database/database.go->connectToDB>")
log.Println(err)
}
defer Tiukudb.Close()
*/
}