web: improve router performance.

Use map to lookup routes when possible.