main.go.disabled 524 B

1234567891011121314151617181920212223
  1. package main
  2. import (
  3. "fmt"
  4. "net/http"
  5. )
  6. func redirectToImuslab(w http.ResponseWriter, r *http.Request) {
  7. fmt.Println(r.RequestURI)
  8. w.Header().Set("Location", "https://imuslab.com")
  9. w.WriteHeader(http.StatusTemporaryRedirect)
  10. w.Write([]byte("Redirecting to imuslab"))
  11. }
  12. func listindex(w http.ResponseWriter, r *http.Request) {
  13. w.Write([]byte("Hello World"))
  14. }
  15. func main() {
  16. http.HandleFunc("/test", redirectToImuslab)
  17. fmt.Println("Listeing on :8080")
  18. http.ListenAndServe(":8080", nil)
  19. }