         }
     }
 
-    func writePost(_ request: Request) throws -> ResponseRepresentable {
+    func writePostView(_ request: Request) throws -> ResponseRepresentable {
         return try drop.view.make("/admin/write-post.leaf")
     }
 
-    func writePost_(_ request: Request) throws -> ResponseRepresentable {
+    func writePost(_ request: Request) throws -> ResponseRepresentable {
         if let title = request.data["title"]?.string, let text = request.data["text"]?.string {
             var post = Post(title: title, text:text)
             do {

        let router = drop.grouped("admin")
        let routerSecure = router.grouped(protect)
        
        router.get("login", handler: login)
        router.post("login", handler: loginAction)
        routerSecure.get("", handler: index)
        routerSecure.get("write-post", handler: writePost)
        routerSecure.post("write-post", handler: writePost_)
        routerSecure.get("posts", handler: posts)
        routerSecure.get("logout", handler: logout)
    }


        return try drop.view.make("/admin/write-post.leaf")
    }

    func postsView(_ request: Request) throws -> ResponseRepresentable {
        let posts = try Post.all().makeNode()
        return try drop.view.make("admin/posts.leaf", ["posts":posts])
    }
