Skip to content

carchrae/vertx-mod-template-engines

Repository files navigation

To compile and load a template:

eb = vertx.eventBus();
eb.send("dust.compile",new JsonObject().putString("name", "test").putString("source", "hello {x}"));

To render the template with data:

eb.send("dust.render",
	new JsonObject().putString("name","test")
	                .putObject("context",
	                     new JsonObject().putString("x","world!")
	                ),
	new Handler<Message<JsonObject>>() {
		@Override
		public void handle(Message<JsonObject> renderReply) {
			String output = renderReply.body().getString("output", null);
			if (output != null)
				System.out.println("here is your rendered output:\n"+output);
			else
				System.err.println(renderReply.body().getString("error"));
		}
	});
	

About

template engine module

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published