Compare commits

..

1 commit
master ... Go

Author SHA1 Message Date
Joe Wroten
b87ccabca3 Go Hello Worlds Branch 2019-06-21 12:30:24 -05:00
3 changed files with 36 additions and 3 deletions

View file

@ -1,6 +1,16 @@
# Hello (World) Learning
# Hello Go
A place for me to play around with some basic example apps, most commonly "Hello World"'s and "TODO" examples.
```bash
go run hello-world.go
```
**Each language/framework is broken down by branch.**
Prints: `Hello World`
---
```bash
go run hello-world-server.go
```
Launches a webserver

16
hello-world-server.go Normal file
View file

@ -0,0 +1,16 @@
package main
import (
"fmt"
"net/http"
)
func main() {
http.HandleFunc("/", homepage)
fmt.Println("Server is running on http://localhost:8081")
http.ListenAndServe(":8081", nil)
}
func homepage(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "<h1>Hello World</h1>")
}

7
hello-world.go Normal file
View file

@ -0,0 +1,7 @@
package main
import "fmt"
func main() {
fmt.Println("Hello World!")
}