-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy path01_simple_http_server.go
More file actions
34 lines (30 loc) · 939 Bytes
/
01_simple_http_server.go
File metadata and controls
34 lines (30 loc) · 939 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Seriál "Programovací jazyk Go"
// https://www.root.cz/serialy/programovaci-jazyk-go/
//
// Dvanáctá část
// Vývoj síťových aplikací v programovacím jazyku Go (pokračování)
// https://www.root.cz/clanky/vyvoj-sitovych-aplikaci-v-programovacim-jazyku-go-pokracovani/
//
// Repositář:
// https://github.com/tisnik/go-root/
//
// Seznam demonstračních příkladů z dvanácté části:
// https://github.com/tisnik/go-root/blob/master/article_12/README.md
//
// Demonstrační příklad číslo 1:
// Jednoduchý HTTP server
//
// Dokumentace ve stylu "literate programming":
// https://tisnik.github.io/go-root/article_12/01_simple_http_server.html
package main
import (
"io"
"net/http"
)
func mainEndpoint(writer http.ResponseWriter, request *http.Request) {
io.WriteString(writer, "Hello world!\n")
}
func main() {
http.HandleFunc("/", mainEndpoint)
http.ListenAndServe(":8000", nil)
}