I'm trying to make a get request to "https://poe.ninja/data" but its not working how I thought it would and not sure how to get to that page specifically.
I'm relatively new to go and programming as a whole so if I'm missing anything obvious or completely off the track on how http.get works for this please let me know.
I've tried :The homepage and that seems to be working as I thought. https://poe.ninja/https://xkcd.com and https://xkcd.com/100This works as I'd thought too getting the homepage and the 100 comic respectively
resp, err := http.Get("https://poe.ninja/data/")if err != nil {panic(err)}defer resp.Body.Close()body, err := ioutil.ReadAll(resp.Body)if err != nil {panic(err)}fmt.Println(string(body))//From said code I'd expect to get the /data path but instead only get the homepage
Best Answer
React, Vue and other front-end frameworks use client-side routing (JavaScript path detection) to render content into the browser. This prevents the need for the client to contact the web server on every click and navigation. This could mean one of two things:
- The client will make an API call to the server to fetch the data. Use something like Developer Tools' Network tab to keep dibs on what endpoints the client it communicating with
- Using a headless Chrome/WebKit, etc approach with JavaScript enabled. This will allow your tool to pull down the page contents, render using JavaScript, and ultimately return the computed front-end code. Due to the way that clients render single page apps, it may be difficult following specific
div#id
anddiv#class
elements