Short version:
How do I call functions defined in server.js in index.html and client-side js functions?
Long version:
My goal is to have a site user input an ID on index.html, cross-check that info with a simple database (currently using lowdb) and return the user’s information associated with that ID. Since it seems I can’t use lowdb on the client side, I was wondering how I could access functions defined in server.js in index.html and client-side js?
I have experimented with doing something like this on the server side:
Big problems with this is that all client data is super easy to get, which allows for anyone to get access to all your client data. Probably not the best of ideas.
Yes, it’s not too hard. Plus, there’s no such thing as CORS if you’re making a request from Node.js using a package like node-fetch, although that can also be prevented by using another package named (surprise, surprise!) cors.