-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.go
More file actions
31 lines (24 loc) · 719 Bytes
/
app.go
File metadata and controls
31 lines (24 loc) · 719 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
package main
import (
"net/http"
"os"
)
func main() {
env := os.Getenv("GO_ENV")
port := os.Getenv("PORT")
if env == "" {
env = "development"
}
if port == "" {
port = "8080"
}
if env == "development" {
http.Handle("/styles/", http.StripPrefix("/styles/", http.FileServer(http.Dir("client/.tmp/styles"))))
http.Handle("/common/fonts/", http.StripPrefix("/common/fonts/", http.FileServer(http.Dir("client/.tmp/common/fonts"))))
http.Handle("/js/", http.StripPrefix("/js/", http.FileServer(http.Dir("client/.tmp/js"))))
http.Handle("/", http.FileServer(http.Dir("./client/app")))
} else {
http.Handle("/", http.FileServer(http.Dir("./client/dist")))
}
http.ListenAndServe(":"+port, nil)
}