Álvaro Ramírez
RoutingHTTPServer snippet
RoutingHTTPServer snippet:
RoutingHTTPServer *routingHTTPServer = [[RoutingHTTPServer alloc] init]; [routingHTTPServer setPort:8000]; [routingHTTPServer setDefaultHeader:@"Server" value:@"YourAwesomeApp/1.0"]; [routingHTTPServer handleMethod:@"GET" withPath:@"/hello" block:^(RouteRequest *request, RouteResponse *response) { [response setHeader:@"Content-Type" value:@"text/plain"]; [response respondWithString:@"Hello!"]; }]; NSError *error = nil; if (![routingHTTPServer start:&error]) { NSLog(@"Error starting HTTP Server: %@\n", error); }