rewrite for new architecture
baseUrl middleware & url.resolve fix