-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathBackend.java
More file actions
29 lines (21 loc) · 791 Bytes
/
Backend.java
File metadata and controls
29 lines (21 loc) · 791 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package io.vertx.example.web.proxy;
import io.vertx.core.Future;
import io.vertx.core.VerticleBase;
import io.vertx.core.http.HttpServer;
import io.vertx.ext.web.Router;
public class Backend extends VerticleBase {
@Override
public Future<?> start() throws Exception {
HttpServer backendServer = vertx.createHttpServer();
Router backendRouter = Router.router(vertx);
backendRouter
.get("/foo")
.respond(ctx -> Future.succeededFuture("<html><body><h1>I'm the target '/foo' resource!</h1></body></html>"));
backendRouter
.get("/private")
.respond(ctx -> Future.succeededFuture("<html><body><h1>I'm the target '/private' resource!</h1></body></html>"));
return backendServer
.requestHandler(backendRouter)
.listen(7070);
}
}