summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/main.go b/main.go
index f5391cf..a595ab1 100644
--- a/main.go
+++ b/main.go
@@ -1,7 +1,18 @@
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() {
@@ -11,4 +22,21 @@ func main() {
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!")
}