How do I add external CSS/Javascript files in Vertx? I have managed to send index.html, which is displayed. This index.html has some external Javascript/CSS files, and the vertx is not loading the CSS/Javascript files in index.html. The code is given below.
public void start() {
vertx.createHttpServer().requestHandler(req -> {
req.response()
.putHeader("content-type", "text/html")
.sendFile("index.html");
}).listen(8080);
}
and in index.html
<html>
<head>
<script src="someJsFile.js"></script>
</head>
<body>
Hello World
</body>
</html>
this is vertx 3
config router to serve static content
router.route().handler(StaticHandler.create());
my static files in folder src/main/resources/webroot