2018-01-26 08:43:53 +01:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
"net/http"
|
|
|
|
|
2018-01-26 14:49:03 +01:00
|
|
|
"git.klink.asia/paul/certman/services"
|
2018-01-26 08:43:53 +01:00
|
|
|
|
|
|
|
"git.klink.asia/paul/certman/router"
|
|
|
|
"git.klink.asia/paul/certman/views"
|
|
|
|
|
|
|
|
// import sqlite3 driver once
|
|
|
|
_ "github.com/mattn/go-sqlite3"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
|
|
|
|
// Connect to the database
|
2018-01-26 14:49:03 +01:00
|
|
|
db := services.InitDB()
|
2018-01-26 08:43:53 +01:00
|
|
|
|
|
|
|
// load and parse template files
|
|
|
|
views.LoadTemplates()
|
|
|
|
|
|
|
|
mux := router.HandleRoutes(db)
|
|
|
|
|
2018-01-26 14:49:03 +01:00
|
|
|
err := http.ListenAndServe(":8000", mux)
|
2018-01-26 08:43:53 +01:00
|
|
|
log.Fatalf(err.Error())
|
|
|
|
}
|