forked from TripwireTeam/tripwire
30 lines
552 B
Go
30 lines
552 B
Go
package main
|
|
|
|
import (
|
|
"log"
|
|
"net/http"
|
|
|
|
"github.com/gorilla/mux"
|
|
)
|
|
|
|
func notFoundStub(w http.ResponseWriter, r *http.Request) {
|
|
err := YggError{Code: 404, Error: "Not Found", ErrorMessage: "The server has not found anything matching the request URI"}
|
|
sendError(w, err)
|
|
}
|
|
|
|
func handleRequests() {
|
|
r := mux.NewRouter().StrictSlash(true)
|
|
registerEndpoints(r)
|
|
log.Fatal(http.ListenAndServe(":10000", r))
|
|
}
|
|
|
|
func main() {
|
|
log.Println("Tripwire initializing...")
|
|
initDB()
|
|
|
|
log.Println("Tripwire started.")
|
|
|
|
handleRequests()
|
|
|
|
defer DB.Close()
|
|
}
|