Golang I cannot access this site

Asked 2 years ago, Updated 2 years ago, 83 views

If you run Golang's main.go, it says you can't access this site.
Did something go wrong with this? (I didn't mess with anything)

main.go

package main

import(
    "net/http"
    "html/template"
)

funcmain(){
    http.HandleFunc("/home", index)
    http.ListenAndServe(":80", nil)
}

func index(whttp.ResponseWriter,r*http.Request){
    getindex: = template.Must(template.ParseFiles("index.html"))
    getindex.ExecuteTemplate(w, "index.html", nil)
}

go

2022-09-30 18:13

1 Answers

Isn't the firewall working?If so,

$sudo ufw allow80

Wouldn't it be possible to access the site by running ?


2022-09-30 18:13

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.