Commit 334c773a authored by santiaago's avatar santiaago
Browse files

app now handles angular routes and golang routes

parent ec6c520b
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@ package main

import (
	"flag"
	"fmt"
	"log"
	"net/http"
	"os"
@@ -10,6 +11,8 @@ import (
var root = flag.String("root", "app", "file system path")

func main() {
	http.HandleFunc("/black/", blackHandler)
	http.HandleFunc("/green/", greenHandler)
	http.Handle("/", http.FileServer(http.Dir(*root)))
	log.Println("Listening on " + os.Getenv("PORT"))
	err := http.ListenAndServe(":"+os.Getenv("PORT"), nil)
@@ -17,3 +20,11 @@ func main() {
		log.Fatal("ListenAndServe:", err)
	}
}

func blackHandler(w http.ResponseWriter, r *http.Request) {
	fmt.Fprintf(w, "black handler!")
}

func greenHandler(w http.ResponseWriter, r *http.Request) {
	fmt.Fprintf(w, "green handler!")
}