Have you tried this library https://www.npmjs.com/package/geojson-path-finder ? It also has a demo (https://www.liedman.net/geojson-path-finder/) where the GeoJson is a road network like in your case.
If what you actually wanted was to write the algorithm by yourself i guess you can checkout their code since its open source, seems the lib makes use of dijkstra.