Update lib/middleware.js

Remove mkdir, which resulted in errors on some platforms.