I am currently using Flask
and axios
. I have a redirect
on the Flask side with data that is passed, resulting in my having to put the decorator as /results/<usr>/
. When I do a print
, the results show up inside my Python cmd
. On my front end side using VUE, I have the code block below that I assumed would be able to get the information returned under the /results/<usr>
block. However, none of the console.log
actually gets logged in my browser. I have tried sending a POSTMAN
request but that has failed as well.
I am unsure if I need to provide parameters besides "http://127.0.0.1:5000/results/"
under my path
variable for the VUE portion. Any advice will be appreciated!
Flask
@app.route('/', methods=["GET", "POST"])
def home():
if request.method == "GET":
data = request.get_json()
return redirect(url_for("getResults", usr = data))
@app.route('/results/<usr>')
def getResults(usr):
if request.method == "GET":
return "Please work :<"
VUE
methods:{
getResponse(){
const path = "http://127.0.0.1:5000/results/";
axios.get(path)
.then((res) => {
console.log("I am reading this");
console.log(res.data);
})
.catch((err) => {
console.error(err);
});
},
}