Matrix (Element) | @ange:gmoker.com |
Matrix (Element) | @ange:gmoker.com |
Discord | @elrilio |
Phone (France) | +33 5 82 95 16 23 |
ange@yw5n.com | |
+62 853-3355-9453 | |
+62 853-3355-9453 |
diff --git a/manifests/common/app.yaml b/manifests/common/app.yaml index 3981559..190b834 100644 --- a/manifests/common/app.yaml +++ b/manifests/common/app.yaml @@ -61,4 +61,4 @@ spec: imagePullPolicy: Always ports: - name: http - containerPort: 80 + containerPort: 3000 diff --git a/nginx.conf b/nginx.conf deleted file mode 100644 index dccd762..0000000 --- a/nginx.conf +++ /dev/null @@ -1,14 +0,0 @@ -server { - listen 80; - listen [::]:80; - server_name localhost; - - location / { - root /usr/share/nginx/html; - index index.html; - } - - location /static/ { - root /usr/share/nginx/; - } -} diff --git a/src/main.go b/src/main.go new file mode 100644 index 0000000..e5309d1 --- /dev/null +++ b/src/main.go @@ -0,0 +1,33 @@ +package main + +import ( + "log" + "net/http" + "path/filepath" + "strings" +) + +func html(w http.ResponseWriter, r *http.Request) { + if r.URL.Path == "/style.css" { + http.ServeFile(w, r, "/html/style.css") + return + } + if strings.HasPrefix(r.URL.Path, "/static/") { + http.ServeFile(w, r, r.URL.Path) + return + } + if r.URL.Path == "/" { + http.ServeFile(w, r, "/html/index.html") + return + } + http.ServeFile(w, r, filepath.Join("/html", r.URL.Path + ".html")) +} + +func main() { + http.HandleFunc("/", html) + + err := http.ListenAndServe(":3000", nil) + if err != nil { + log.Fatal(err) + } +} diff --git a/src/vars/vars.go b/src/vars/vars.go new file mode 100644 index 0000000..5108d04 --- /dev/null +++ b/src/vars/vars.go @@ -0,0 +1,19 @@ +package vars + +import ( + "path/filepath" +) + +var ( + templates string + static string + html string + css string +) + +func init() { + templates = "templates" + static = "static" + html = filepath.Join(static, "html") + css = filepath.Join(static, "css") +}