check dir exists, add router and layout