making the javascript route writing be pluggable. Closes GH-789