|
|
|
|
|
by skanga
3846 days ago
|
|
Great - Got it to work. This should be documented on your site. You also forgot to mention what I need to import in order to have the "On" object. Maybe you can include something like this template on your getting started page. import org.rapidoid.http.fast.*;
// wget https://repo.maven.apache.org/maven2/org/rapidoid/rapidoid-http-fast/5.0.7/rapidoid-http-fast-5.0.7.jar
public class App
{
public static void main (String[] args)
{
On.get ("/size").json ("msg", msg -> msg.length ());
}
}
Also needed would be a sample pom.xml file. I had a problem with java compiler version being older and unable to complie lambdas.My sample pom.xml (feel free to use it if you like) is: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.microservices.app</groupId>
<artifactId>rest-app</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>rest-app</name>
<url>http://maven.apache.org</url>
<properties>
<java.version>1.8</java.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.6</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>assemble-all</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.rapidoid</groupId>
<artifactId>rapidoid-web</artifactId>
<version>5.0.5</version>
</dependency>
</dependencies>
</project>
Then I can run the test service using: java -cp target/rest-app-1.0-SNAPSHOT-jar-with-dependencies.jar App
|
|
I totally agree a tutorial like this is needed, and I am going to add such documentation soon...