This commit is contained in:
1 parent
7a2e79682c
commit
a95df7c42b
2 files changed
+52
-20
No files matched your search
@@ -0,0 +1,27 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func webServer() {
|
||||
// Start web server
|
||||
|
||||
//Public static files
|
||||
http.Handle("/public/", http.StripPrefix("/public/", http.FileServer(http.Dir("public"))))
|
||||
|
||||
// Page Handlers
|
||||
// Anything that is responsible for the base elements of a viewable web page
|
||||
http.HandleFunc("/", homePageHandler)
|
||||
|
||||
log.Print("Service listening on :8080")
|
||||
log.Printf("Web server unexpectedly exiting!: %v", http.ListenAndServe(":8080", nil))
|
||||
|
||||
}
|
||||
|
||||
func homePageHandler(w http.ResponseWriter, r *http.Request) {
|
||||
refreshData()
|
||||
http.Redirect(w, r, fmt.Sprintf("https://app.ynab.com/%s", ynabClient.BudgetID), http.StatusSeeOther)
|
||||
}
|
||||
Reference in new issue
Block a user