Leaflet Routing Machine / OSRM 4
Some brief instructions follow below, but the Leaflet Routing Machine tutorial on alternative routers is recommended.
Go to the releases page to get the script to include in your page. Put the script after Leaflet and Leaflet Routing Machine has been loaded.
To use with for example Browserify:
npm install --save lrm-osrm4
There's a single class exported by this module,
L.Routing.OSRM4. It implements the
IRouter interface. Use it to replace Leaflet Routing Machine's default OSRM 5 router implementation:
var L = ;;; // This will tack on the class to the L.Routing namespaceLRouting;
Note that you will need to set up your own OSRM4 server: OSRM's demo server is running OSRM 5.