aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillermo Serrahima <dev@vylion.com>2026-02-19 11:20:50 +0100
committerGuillermo Serrahima <dev@vylion.com>2026-02-19 11:53:02 +0100
commit9736e31578121b8c1a0377d98a97f3b79b838d53 (patch)
tree903fd90abac941c46a5cb545a1ee9da82d64b2ca
downloadllostre-9736e31578121b8c1a0377d98a97f3b79b838d53.tar.xz
llostre-9736e31578121b8c1a0377d98a97f3b79b838d53.zip
hello world
-rw-r--r--.gitignore1
-rw-r--r--backend/go.mod3
-rw-r--r--backend/main.go29
3 files changed, 33 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..600d2d3
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+.vscode \ No newline at end of file
diff --git a/backend/go.mod b/backend/go.mod
new file mode 100644
index 0000000..c893275
--- /dev/null
+++ b/backend/go.mod
@@ -0,0 +1,3 @@
+module llostre/backend
+
+go 1.25.7
diff --git a/backend/main.go b/backend/main.go
new file mode 100644
index 0000000..f5c754c
--- /dev/null
+++ b/backend/main.go
@@ -0,0 +1,29 @@
+package main
+
+import (
+ "fmt"
+ "io"
+ "net/http"
+)
+
+func helloHandler(w http.ResponseWriter, _ *http.Request) {
+ w.Write([]byte("Hello, World!"))
+}
+
+func requestServer() {
+ resp, err := http.Get("http://localhost:8080")
+ fmt.Println(err)
+ defer resp.Body.Close()
+ body, err := io.ReadAll(resp.Body)
+ fmt.Printf("\nWebserver said: `%s`", string(body))
+}
+
+func main() {
+ http.HandleFunc("/", helloHandler)
+ go func() {
+ err := http.ListenAndServe(":8080", nil)
+ fmt.Println(err) // don't ignore errors
+ }()
+
+ requestServer()
+}