This repository serves as my own API of static JSON data for the creation of google maps markers.
This list curates a list of places to see when in DFW grouped by category.
It's intended to feed a single page React app, but can be used for any reason.
Cheers!
This approach based on this article.
See src
directory.
See fetch-basicBrowswerClient.js
//see https://developers.google.com/web/updates/2015/03/introduction-to-fetch
function status(response) {
if (response.status >= 200 && response.status < 300) {
return Promise.resolve(response);
} else {
return Promise.reject(new Error(response.statusText));
}
}
function json(response) {
return response.json();
}
const DFW_TIPS_API_URL =
'https://rudimusmaximus.github.io/dfwTips/dfwTipsAPI.json';
fetch(DFW_TIPS_API_URL)
.then(status)
.then(json)
.then( data => console.log(`Request succeeded with JSON response: `, data))
.catch(error => console.log(`Request failed: `, error));
See src
directory.
If using a copy of XMLHttpRequest-basicBrowserClient.js
const DFW_TIPS_API_URL = 'https://rudimusmaximus.github.io/dfwTips/dfwTipsAPI.json'
hitApi(DFW_TIPS_API_URL, function(error, data) {
if (error) {
console.log('there was an error', error);
} else {
console.log('data is', data);
}
});
I curate a list and keep it in a google sheets file here.
I use this sheets add-on to export to JSON: Export Sheet Data sheets add-on
Original idea from this article Making a JSON API with GitHub Pages. The add on is open source and can be found on GitHub at: github.com/Synthoid/ExportSheetData
I use this tool to get the lat/lng for the markers using the address of each location.