CRUD
From APIDesign
(→Clients) |
(→REST Server) |
||
Line 20: | Line 20: | ||
<source lang="bash"> | <source lang="bash"> | ||
+ | # assuming you are in examples/jerseyfaces/ directory | ||
$ cd server | $ cd server | ||
$ mvn exec:java | $ mvn exec:java |
Revision as of 08:48, 31 July 2014
When showing the usefulness of DukeScript some people believe it is best demonstrated on games like MineSweeper. Other group recommends to show CRUD - as a typical business oriented application.
It is my pleasure to announce a sample DukeScript CRUD being (almost) ready (almost, because it depends on a snapshot version of Jersey, but that should not stop you trying it).
Contents |
CRUD for Java, iOS, Android and any browser
First of all the basic setup:
$ git clone https://github.com/jtulach/jersey.git $ cd jersey/ $ git checkout d6e0bf4c98a0b229aa3c2b14cea73031b78ee59f $ cd examples/jerseyfaces/ $ mvn clean install
REST Server
Now you should open server project in NetBeans IDE and start it or debug it. Alternatively you can stick with command line Maven and try:
# assuming you are in examples/jerseyfaces/ directory $ cd server $ mvn exec:java INFO: Started listener bound to [localhost:8080] Press Enter to shutdown the server
the server gets started on given port, which you may inspect in your browser. The resource name is contacts, e.g. the URL is http://localhost:8080/contacts - keep server process running.
Clients
However that is not the important part. More interesting is to see the variety of clients that we have. Open the client project in NetBeans IDE and either run or debug it - you get desktop client (plus a tooling support in NetBeans). Alternatively stick with Maven to see the client as well (without any tooling):
$ cd client $ mvn exec:java
If you reproduced my steps properly, you will see record with information about me which you can modify, delete or create your own ones.
Let's try another client. From the client project's popup menu choose Custom/Run in a Browser and you'll get client which looks the same, but runs in real browser, even without Java plugin installed - completely client side technology thanks to our VM. Again, this can be done from command line:
$ mvn -Pbck2brwsr clean package bck2brwsr:show -Dbck2brwsr.obfuscationlevel=NONE
Next Steps
Of course, there are other clients (hint iOS, Android) in the Custom menu, but I think, the point has been made. Try it and let me know if something is broken. I'd like to turn this into a Maven archetype, so a bit of testing is going to be useful. Thanks for your help.
<comments/>