Implement middlewares, add samples/directory-sample.jsx