1
mirror of https://github.com/jakejarvis/npqueue.git synced 2025-11-04 05:40:10 -05:00

host everything on heroku

This commit is contained in:
2019-06-24 17:29:00 -04:00
parent a9f902ba30
commit ad5d6aee2d
9 changed files with 4 additions and 2 deletions

View File

View File

@@ -149,7 +149,7 @@ func getPlayerNoPixelInformation(id string) (p NoPixelPlayer) {
return
}
// List handler for Heroku /api/list route
// List handler for now.sh /api/list route
func List(w http.ResponseWriter, r *http.Request) {
err := loadPlayersJSON()
if err != nil {
@@ -168,6 +168,8 @@ func main() {
addr := ":" + os.Getenv("PORT")
http.HandleFunc("/api/list", List)
http.Handle("/", http.FileServer(http.Dir("./static")))
log.Printf("Listening on %s...\n", addr)
if err := http.ListenAndServe(addr, nil); err != nil {
panic(err)

View File

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 66 KiB

View File

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

View File

@@ -1,7 +1,7 @@
document.addEventListener("DOMContentLoaded", updateData, false);
async function fetchData() {
let request = await fetch("https://hidden-depths-42970.herokuapp.com/api/list");
let request = await fetch("/api/list");
if(request.status == 200) {
console.log("New JSON successfully fetched!");
let data = await request.json();