Added the ability to use optional paramters in routes

Routes will now replace {id?} parameters and remove them from the route if they are not supplied. This makes the use of optional parameters possible.