Swiftpack.co - Swift Packages by twof

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.

Packages published by twof

twof/VaporCRUDRouter 4.0.0
A Rails-inspired extension to Vapor's routing system
⭐️ 66
🕓 2 years ago
🔖 Release Notes

Releases

The markdown parsing is broken/disabled for release notes. Sorry about that, I'm chasing the source of a crash that's been bringing this website down for the last couple of days.
Vapor 4 Support
2 years ago
## What's Changed * fixed an issue on children crud generation by @FedeGens in https://github.com/twof/VaporCRUDRouter/pull/7 * Update to Vapor-beta.3 / Fluent-beta.2 by @simonedelmann in https://github.com/twof/VaporCRUDRouter/pull/9 * Vapor 4 Support by @twof in https://github.com/twof/VaporCRUDRouter/pull/10 ## New Contributors * @FedeGens made their first contribution in https://github.com/twof/VaporCRUDRouter/pull/7 * @simonedelmann made their first contribution in https://github.com/twof/VaporCRUDRouter/pull/9 **Full Changelog**: https://github.com/twof/VaporCRUDRouter/compare/1.7.0...4.0.0 This change should be largely non-breaking. The only breaking change is that the library now requires Vapor 4. All public APIs are unchanged.
All `.crud` methods no longer throw
5 years ago
All public APIs were (unnecessarily) throwing, which meant they all looked like ```swift try router.crud(register: Todo.self) ``` All public API calls can now be slightly simplified to ```swift router.crud(register: Todo.self) ```
Relations can now recurse infinitely
5 years ago
Nest your routes to your heart's content 😄 ```swift try router.crud(register: User.self, .only([.read])) { controller in try controller.crud(children: \.todos, .only([.read])) { childrenController in try childrenController.crud(siblings: \.tags, .only([.read])) { siblingsController in try siblingsController.crud(siblings: \.todos, .only([.read])) } } } ``` produces ``` GET/user/:id GET/user/:id/todo/:id GET/user/:id/todo/:id/tag/:id GET/user/:id/todo/:id/tag/:id/todo/:id ```
Introduce method exclusion/inclusion
5 years ago
#### Including or Excluding Specific Routes If you'd like to register a `Model`, but you don't want every route to be available, you can specify the ones you want, or exclude the ones you don't. ```swift try router.crud(register: Todo.self, .except([.create, .delete])) { controller in try controller.crud(parent: \.owner, .only([.read])) } ``` results in ``` PUT /todo/int GET /todo/int GET /todo GET /todo/int/tag/int ```
API renaming
5 years ago
Shortened all public APIs from `crudRegister()` to ``` swift try router.crud(register: User.self) { controller in try controller.crud(children: \.todos) } ```
Enable nested exposure of Siblings
5 years ago
Siblings can now be exposed alongside Children and Parents ```swift try router.crudRegister(for: Todo.self) { controller in try controller.crudRegister(forSiblings: \.tags) } try router.crudRegister(for: Tag.self) { controller in try controller.crudRegister(forSiblings: \.todos) } ``` exposes ``` GET /todo/:id GET /todo POST /todo PUT /todo/:id DELETE /todo/:id GET /todo/:id/tag/:id GET /todo/:id/tag POST /todo/:id/tag PUT /todo/:id/tag/:id DELETE /todo/:id/tag/:id GET /tag/:id GET /tag POST/tag PUT /tag/:id DELETE /tag/:id GET /tag/:id/todo/:id GET /tag/:id/todo POST /tag/:id/todo PUT /tag/:id/todo/:id DELETE /tag/:id/todo/:id ```
Enable nested exposure of Children and Parents
5 years ago
Siblings to come. Just working out some kinks ```swift try router.crudRegister(for: Todo.self) { controller in try controller.crudRegister(at: "owner", forParent: \.owner) } try router.crudRegister(for: User.self) { controller in try controller.crudRegister(forChildren: \.todos) } try router.crudRegister(for: Tag.self) ```
Default route paths to model names
5 years ago
5 years ago
macOS

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics