protect the router and always return a value...even if it's 500...also, close the response in a finally block from the router. Finally, add optional flag to a parameter using the format :?dir=(.+) where the ? is the optional flag.