Guest User

Untitled

a guest
Jan 19th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. package main
  2.  
  3. import (
  4. "http"
  5. "io"
  6. "os"
  7. "fmt"
  8. "strconv"
  9. )
  10.  
  11. func MainPage(w http.ResponseWriter, req *http.Request) {
  12.  
  13. io.WriteString(w, "Hi, download here: <a href=\"/FileTest\">HERE</a>")
  14. }
  15.  
  16.  
  17. func main() {
  18. fmt.Print("Port: ")
  19. var hi int
  20. fmt.Scanf("%d", &hi)
  21. http.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) {
  22. io.WriteString(w, "Hi")
  23. })
  24.  
  25. err := http.ListenAndServe("0.0.0.0:" + strconv.Itoa(hi), nil)
  26.  
  27. if err != nil {
  28. fmt.Print(err)
  29. fmt.Print((hi))
  30. }
  31. }
Add Comment
Please, Sign In to add comment