I am trying to define a new icon for my points in Leaflet but am drawing a blank. I am using Fetch (see code) to access the data and have it displayed with the default icon but can't work out how to change it to another within the fetch. Thanks.
let puburl = "http:...
let pubIcon = new L.icon({
iconUrl: 'markers/beer.png'
});
fetch(puburl)
.then(function(response) {
return response.json();
})
.then(function(data) {
L.geoJSON(data, {
onEachFeature: function(feature, layer) {
layer.bindPopup("<a href='" + feature.properties.URL + "'>" + feature.properties.PubName + "</a>")
}
}).addTo(map);
});