commit b938be9745e395e80bad90ccfdc66d1900940a6f Author: Valentijn van der Jagt <120188387+HerpieDerpieee@users.noreply.github.com> Date: Sun Mar 8 20:32:37 2026 +0100 basic setup diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4c49bd7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.env diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..69caf2f --- /dev/null +++ b/go.mod @@ -0,0 +1,7 @@ +module DHLTracker/main + +go 1.25.0 + +require github.com/joho/godotenv v1.5.1 + +require github.com/mattn/go-sqlite3 v1.14.34 // indirect diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..b3f44da --- /dev/null +++ b/go.sum @@ -0,0 +1,4 @@ +github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0= +github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= +github.com/mattn/go-sqlite3 v1.14.34 h1:3NtcvcUnFBPsuRcno8pUtupspG/GM+9nZ88zgJcp6Zk= +github.com/mattn/go-sqlite3 v1.14.34/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= diff --git a/main.go b/main.go new file mode 100644 index 0000000..acfc8db --- /dev/null +++ b/main.go @@ -0,0 +1,24 @@ +package main + +// https://stackoverflow.com/questions/61080317/go-lang-very-simple-http-post-requests-and-response-endpoint (simple post endpoint) +// https://stackoverflow.com/questions/16466320/is-there-a-way-to-do-repetitive-tasks-at-intervals +import ( + "log" + "net/http" + + _ "github.com/mattn/go-sqlite3" +) + +func checkRequestHeader(req *http.Request, res http.ResponseWriter, method string) bool { + if req.Method == method { + return true + } + res.WriteHeader(http.StatusMethodNotAllowed) + return false +} + +func main() { + + log.Println("[Main] now serving 0.0.0.0:8090") + http.ListenAndServe(":8090", nil) +}