helper function to create routes