Created
August 14, 2019 22:14
-
-
Save caesaneer/2810c9fbcfdc2c5bd6804c966f2d80db to your computer and use it in GitHub Desktop.
Go Goroutines vs Node.js Cluster & Worker Threads - Part 1 - Go Code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"net/http" | |
"runtime" | |
) | |
func ok(w http.ResponseWriter, req *http.Request) { | |
fmt.Fprintf(w, "OK") | |
} | |
func main() { | |
c := runtime.GOMAXPROCS(1) | |
fmt.Println("PREVIOUS CPUs:", c) | |
a := "192.168.0.14:4000" | |
http.HandleFunc("/", ok) | |
fmt.Println("Go Standard Library HTTP server running at:", a) | |
http.ListenAndServe(a, nil) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment