 protocol PostRepository {
     func all() -> EventLoopFuture<[Post]>
 }
-
-struct PostRepositoryMiddleware: Middleware {
-    let makePosts: (Request) -> PostRepository
-    
-    func respond(to request: Request, chainingTo next: Responder) -> EventLoopFuture<Response> {
-        request.posts = self.makePosts(request)
-        return next.respond(to: request)
-    }
-}
-
-extension Request {
-    var posts: PostRepository {
-        get {
-            guard let post = self.userInfo["post"] as? PostRepository else {
-                fatalError("PostRepository not configured on request")
-            }
-            return post
-        }
-        set {
-            self.userInfo["post"] = newValue
-        }
-    }
-}

    
    func shutdown() {
        // nothing
    }
}


            ]
        }, as: .test)
        
        app.posts.use {
            DatabasePostRepository(database: $0.db(.test))
        }
        
        app.get("foo") { req -> EventLoopFuture<[Post]> in
            req.posts.all()
