common route parsing for client & server