feat(sources) uploading sources

main 1.0.0
Valentin 2024-08-05 15:03:43 +02:00
parent e70e069662
commit 3d2cb71808
4 changed files with 24 additions and 0 deletions

1
.gitattributes vendored Normal file
View File

@ -0,0 +1 @@
* -text

2
.gitignore vendored
View File

@ -23,3 +23,5 @@ go.work.sum
# env file # env file
.env .env
build/*

3
src/go.mod Normal file
View File

@ -0,0 +1,3 @@
module itsmrval/http-to-https
go 1.22.5

18
src/main.go Normal file
View File

@ -0,0 +1,18 @@
package main
import (
"log"
"net/http"
)
func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
targetURL := "https://" + r.Host + r.RequestURI
http.Redirect(w, r, targetURL, http.StatusMovedPermanently)
})
log.Println("Service running on :80")
if err := http.ListenAndServe(":80", nil); err != nil {
log.Fatalf("%v", err)
}
}