Tidied up route function slightly

Store the file path in a variable to conform to DRY, removing
repetition, and the possibility for errors.