This repository has been archived on 2022-10-30. You can view files and clone it, but cannot push or open issues or pull requests.
Segfautils/main.go
Odyssey346 628bc92e66 ok cool lets make CheckEnv actually do something and oh lets make it modular
Signed-off-by: Odyssey346 <odyssey346@disroot.org>
2022-07-22 21:34:09 +02:00

29 lines
688 B
Go

package main
import (
"net/http"
"html/template"
"io"
"log"
"github.com/ProjectSegfault/segfautilities/otherthings"
)
type StaticThingy struct {
Port string
}
func main() {
log.Println("[Segfautilities] Starting")
otherthings.CheckEnv()
tmpl := template.Must(template.ParseFiles("static/index.html"))
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
data := StaticThingy{
Port: "3000",
}
tmpl.Execute(w, data)
})
http.HandleFunc("/api/", func(w http.ResponseWriter, r *http.Request) {
io.WriteString(w, "welcome to hell")
})
http.ListenAndServe(":3000", nil)
}