Last active
August 31, 2016 08:12
-
-
Save back2dos/e511fbca7fe7d831f7ba45c3200c6941 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| class User { | |
| var id:String; | |
| public function new(id) | |
| this.id = id; | |
| @:get('/profile/') | |
| public function profile() | |
| return 'profile of $id'; | |
| @:get('/whatever/$otherId/etc') | |
| public function whatever(otherId) | |
| return 'whatever of $id and $otherId'; | |
| } | |
| class UserCollection { | |
| @:post('/') public function createNew(); | |
| @:get('/') public function list(query:{ /* some filter criteria */}); | |
| @:get('/') public function byId(id:String) | |
| return new User(id); | |
| } | |
| class Root { | |
| @:sub public var users(default, null):UserCollection = new UserCollection(); | |
| @:sub('/me') public function me() | |
| return users.byId(getIdFromAuthHeader()); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment