Skip to content

Commit

Permalink
feat(structure): serve website from the go server
Browse files Browse the repository at this point in the history
instead of relying on a seperate hoster for the front end, serve
everything from this backend

also include listings and sites files in the static files
  • Loading branch information
gabeklavans committed Feb 29, 2024
1 parent 886f032 commit 52b2521
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
1 change: 0 additions & 1 deletion data/listings-example.json

This file was deleted.

1 change: 1 addition & 0 deletions listings-example.json

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions public/script.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
let propertiesObject = {};
let propertiesDiv = document.getElementsByClassName("properties");

fetch("https://ygl.dabe.tech/sites")
fetch("./data/sites.json")
.then((response) => response.json())
.then((sites) => {
fetch("https://ygl.dabe.tech/listings")
fetch("./data/listings.json")
.then((response) => response.json())
.then((json) => {
propertiesObject = json;
.then((propertiesObject) => {
// console.log(propertiesObject);
let i = 0;

Expand Down
File renamed without changes.
6 changes: 5 additions & 1 deletion src/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"log"
"net/http"
"os"
"fmt"

"github.com/gin-contrib/cors"
"github.com/gin-gonic/gin"
Expand Down Expand Up @@ -74,6 +75,9 @@ func main() {
router.GET("/ping", basicAuth, ping)
router.GET("/listings", getListings)
router.GET("/sites", getSites)
router.Static("/static", "../public/")

router.Run("192.168.88.22:8083")
domain := os.Getenv("DOMAIN")
ip := os.Getenv("IP")
router.Run(fmt.Sprintf("%s:%s", domain, ip))
}

0 comments on commit 52b2521

Please sign in to comment.