Empty web app

This commit is contained in:
Ian Gulliver
2024-11-24 21:36:03 -06:00
parent 56776b1b7d
commit 5ceef42bb5
3 changed files with 26 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.idea

3
go.mod Normal file
View File

@@ -0,0 +1,3 @@
module github.com/gopatchy/shortlinks
go 1.23.3

22
main.go Normal file
View File

@@ -0,0 +1,22 @@
package main
import (
"fmt"
"log"
"net/http"
"os"
)
func main() {
port := os.Getenv("PORT")
if port == "" {
port = "80"
}
bind := fmt.Sprintf(":%s", port)
log.Printf("listening on %s", bind)
if err := http.ListenAndServe(bind, nil); err != nil {
log.Fatalf("listen: %s", err)
}
}