30 lines
453 B
Go
30 lines
453 B
Go
package main
|
|
|
|
import (
|
|
"net/http"
|
|
"time"
|
|
|
|
"timefu.li/backend/models"
|
|
"timefu.li/backend/routes"
|
|
"timefu.li/backend/tubson"
|
|
"timefu.li/backend/tubsql"
|
|
)
|
|
|
|
|
|
func main() {
|
|
db := tubsql.Connect_database()
|
|
models.Init_tables(db)
|
|
|
|
routes.Register_routes()
|
|
|
|
tubson.Start_server(&http.Server{
|
|
Addr: ":8080",
|
|
Handler: nil,
|
|
ReadTimeout: 10 * time.Second,
|
|
WriteTimeout: 10 * time.Second,
|
|
MaxHeaderBytes: 1 << 20,
|
|
}, func() {
|
|
db.Close()
|
|
})
|
|
}
|