This is an example application that uses LunarCat as a rest framework and Mentat for MySQL-compatible db access. To run it, you will need:
- java 8+
- MySQL / Percona / Maria database
use foo;
create table something (
id bigint auto_increment primary key,
name varchar(128) charset utf8
) engine=InnoDB default charset utf8;
Ok, now that we have that out of the way, run the example app:
git clone [email protected]:muchq/LunarExample.git && cd LunarExample
mvn clean package
java -DPORT=8080 -Dexample.db.user=root -Dexample.db.pass= -Dexample.db.host=localhost -Dexample.db.db=foo -jar target/LunarExample-1.0-SNAPSHOT.jar
Awesome, now let's make some requests:
➜ ~ curl -H "Content-Type: application/json" -X POST -d '{"name": "Andy"}' http://localhost:8080/hello
{"id":1,"name":"Andy"}%
➜ ~ curl http://localhost:8080/hello/1
{"id":1,"name":"Andy"}%