Skip to content

Instantly share code, notes, and snippets.

@back2dos
Last active August 31, 2016 08:12
Show Gist options
  • Select an option

  • Save back2dos/e511fbca7fe7d831f7ba45c3200c6941 to your computer and use it in GitHub Desktop.

Select an option

Save back2dos/e511fbca7fe7d831f7ba45c3200c6941 to your computer and use it in GitHub Desktop.
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