I want to fetch countries and cities from my front end, but I know first, I need to make a server-side script on the backend to be able to do so.
If geography is a mock package where I can do so, and this is the code I have thus far, how could I prepare my backend to receive these fetch requests?
app.get('/:locations', function (req, res) {
Geography.init().then(function() {
console.log(Geography)
Geography.open(req.params.url).then(function(site) {
console.log(Geography)
site.analyze().then(function(results) {
res.json(results)
})
})
})
})
Would it look something like this? (incomplete, of course....)
select
countries
cities
question from:https://stackoverflow.com/questions/65645476/creating-a-server-side-script-to-fetch-from