Skip to content

Instantly share code, notes, and snippets.

@moredip moredip/what I have.m
Last active Dec 20, 2015

Embed
What would you like to do?
+ (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
You can’t perform that action at this time.