Original post

your statements in main and handleallRequests functions are not same .
http.ListenAndServe(“8081” , nil) -> this is not working – program exit
http.ListenAndServe(“:8081”, nil) -> this is working

ListenAndServe method expects IP:PORT string, if you dont want to specify IP you can just mention “:PORT” in main function you are missing “:” and in other function you are using “:”. this is why you are not successfully starting server from main.

you can wrap this code in log.Println(http.ListenAndServe(“:8081”, nil)) so that instantly you can get to know the error !!!