Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/heuermh/spark-template

Template routes for Spark web framework
https://github.com/heuermh/spark-template

Last synced: 9 days ago
JSON representation

Template routes for Spark web framework

Awesome Lists containing this project

README

        

spark-template
==============

###@Deprecated

__Note__: This repo is not necessarily up-to-date and compatible with the current release of Spark.
It should be considered deprecated in favor of the sparkling-template module merged into the sparkling
fork of Spark at https://github.com/heuermh/sparkling.

####Legacy docs

Template routes for Spark web framework:

```java
get(new VelocityTemplateRoute("/hello/:name") {
@Override
public Object handle(final Request request, final Response response) {
Person person = Person.find(request.params("name"));
return template("hello.wm").render("person", person);
}
});
```

To build

$ mvn install

To build velocity example

$ cd velocity-example
$ mvn assembly:assembly

To run velocity example

$ java -jar target/spark-template-velocity-example-0.9.9.5-SNAPSHOT-jar-with-dependencies.jar
== Spark has ignited ...
>> Listening on 0.0.0.0:4567

Then open

http://localhost:4567/hello/foo

in a browser.

To add a new Template engine

- Create a new module
- Add dependency to spark-template
- Add dependency to new template engine
- Extend https://github.com/heuermh/spark-template/blob/master/api/src/main/java/spark/template/TemplateRoute.java
- (optional) Create a new example module