Last active
December 21, 2019 12:35
-
-
Save hsharghi/7c05aa9eb47b9ba035f2c75b31c5f9a7 to your computer and use it in GitHub Desktop.
virgool-blog-0008
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Vapor | |
public func routes(_ router: Router) throws { | |
let postController = PostController() // 1 | |
// 2 | |
/// GET /posts | |
router.get("posts", use: postController.index) | |
/// GET /posts/:id | |
router.get("posts", Post.parameter, use: postController.show) | |
/// POST /posts | |
router.post("posts", use: postController.create) | |
/// PATCH /posts/:id | |
router.patch("posts", Post.parameter, use: postController.update) | |
/// DELETE /posts/:id | |
router.delete("posts", Post.parameter, use: postController.delete) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment