blob: a595ab195921f3e94249f8f3beef6106b5765eaf (
plain)
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
35
36
37
38
39
40
41
42
|
package main
import (
"fmt"
"log"
"net/http"
"time"
"github.com/gorilla/mux"
)
const (
Addr = "127.0.0.1:8000"
ReadTimeout = 15 * time.Second
WriteTimeout = 15 * time.Second
)
func main() {
run()
}
func run() {
log.Println("finserv finance server was started.")
defer log.Println("finserv finance server was stopped.")
r := mux.NewRouter()
r.HandleFunc("/", hello)
srv := &http.Server{
Handler: r,
Addr: Addr,
WriteTimeout: WriteTimeout,
ReadTimeout: ReadTimeout,
}
log.Fatal(srv.ListenAndServe())
}
func hello(w http.ResponseWriter, r *http.Request) {
fmt.Fprintln(w, "Hello world!")
}
|