use default mainPath
add middleware concept