please can someone clarify what I need to do in a framework7/node-js app to trigger a server-side function from client-side? I want a server side script (coded by me) to compile a json file and send me back the name/url before I request that new json file from server side to client side.
This link shows "Request/ajax" in framework7 documentation [1]: https://framework7.io/docs/request.html But there is nothing that I could find about specifying a response.
I can use the below function to get a static already existing json file/data from the server:
//below code placed inside 'pageInit' block
//in the code block 'var app = new Framework7({ })'
//in app.js file
app.request.get("/assets/datafile.json", function (data){
//turn json data into a javascript object
var mobj = JSON.parse(data);
}
I've tried to use node_modules, but the function 'require(module)' which is used to import modules is not available to use from client side files...
I selected 'include bundler' in the npm set up of the project directory, and now I'm working with 'vite'. So I can't find a server file to edit if needed.
I've become confused as how to fetch dynamic data in this situation. I've read online to use a XMLHttprequest on a server side API, I've read you have to wrap the server side code in a 'route', I've read you have to change the server file code, I've read you can use a php script, but I haven't been able to make this thing work with Framework7.
If anyone knows how to do this, please give us a hint. Thanks.