Skip to content

Instantly share code, notes, and snippets.

@moredip
Last active December 20, 2015 14:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moredip/6148900 to your computer and use it in GitHub Desktop.
Save moredip/6148900 to your computer and use it in GitHub Desktop.
+ (void)prepRoutes{
[self handlePostTo:@"/record" with:^{
return [[LPRecordRoute new] autorelease];
}];
[self handlePostTo:@"/play" with:^{
return [[LPAsyncPlaybackRoute new] autorelease];
}];
// etc.
}
+ (void) handlePostTo:(NSString*)path with:(HandlerCreator)handlerCreator{
[[RequestRouter singleton] registerRouteForPath:path
supportingMethods:@[@"POST"]
createdBy:handlerCreator];
}
+ (void)prepRoutes{
[self handlePostTo:@"/record" with:LPRecordRoute];
[self handlePostTo:@"/play" with:LPAsyncPlaybackRoute];
// etc.
}
+ (void) handlePostTo:(NSString*)path with:(Class)handler{
[[RequestRouter singleton] registerRouteForPath:path
supportingMethods:@[@"POST"]
createdBy:^{
return [[handler new] autorelease];
}];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment