This project serves as an example for how to embed and use hegemon in your project. It uses the excellent dropwizard project to make http endpoints available with minimum boilerplate, but hegemon will work equally well with whatever you'd like to include it in.
Get it: $ git clone git://github.com/Cue/hegemon-example.git
Build it: $ cd hegemon-example; mvn package
Run it: $ java -jar target/hegemon-example-0.0.2.jar server
It includes:
-
An http endpoint routing to pre-packaged scripts. Try:
$ curl http://localhost:8080/script/example?foo=bar
-
An endpoint evaluating post data. Try:
$ curl -d "return 3 + 4" http://localhost:8080/customScript
-
Tests in javascript runnable with a JUnit runner.
-
An HTTP server that runs tests and reloads javascript changes without restart. Try opening in a browser: http://localhost:7070/ and click on the test class name.