Skip to content

Instantly share code, notes, and snippets.

@smaldini
Last active August 29, 2015 14:21
Show Gist options
  • Save smaldini/5d93da9aa606b12e4069 to your computer and use it in GitHub Desktop.
Save smaldini/5d93da9aa606b12e4069 to your computer and use it in GitHub Desktop.
a simple proxy
HttpServer<Buffer, Buffer> server = NetStreams.httpServer("0.0.0.0", 80);
server.get("/search/{search}", requestIn ->
NetStreams.httpClient()
.get("http://google.co.uk/?q=" + requestIn.param("search"))
.flatMap(repliesOut -> requestIn.writeWith(repliesOut))
);
server.start().await();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment