For JavaScript please use the JS client: https://github.com/graphhopper/directions-api-js-client
If you want encoded polylines then this is returned by default, no special parameter required.
Please do not use the google decode function as this won’t work, when we include elevation which is the default or set elevation=false.