JavaScript can now be used end-to-end from backend to frontend applications. JaggeryJS is a framework that allows developers to write full web applications using only JavaScript. It provides APIs to access databases, call web services, and integrate with WSO2 products. JaggeryJS applications can be developed similarly to PHP/JSP applications, removing the need to compile or build code. Developers are now able to build rich web applications using JavaScript and common libraries across the full stack.
2. Path
• Why JavaScript
• We will mainly discuss about
JaggeryJS
• Jaggery APIs
• Start with a high level discussion
• Then Hands On
3. Reaching Out the Last Mile
• Users no longer accept
average user experience
• Users Interfaces (UIs) covers
the last mile
• Often decides the success and how
much it will integrate with the
user’s lives.
7. Types of Web Application
• Client side (Static HTML)
• Client driven, blocking (old Forms based submit )
• Client driven, non blocking (AJAX)
• Client and server driven, non-blocking (web sockets)
9. Revolution of UI in Web Apps
• Javascript has become the defacto technology
• Variuos Javascript libaries
• Supported by all browsers
• Thanks goe to
•Web 2.0
•HTML5
• No longer simplistic applications
• Widely used
11. Javascript end to end? (Contd.)
● No complexities in data binding (UI to Business logic
thanks to JSON)
● No serialization / de-serialization
● Rich space with many common javascript libraries
● Rapid application development
● Resourcful
● No compiling, making & building
12. What my options
• NodeJS -
o Based on Google V8 JS engine
o Event driven, non-blocking processing
• Jaggery
o Provided traditional development experience like in
PHP/JSP
o De-facto framework for all WSO2 user facing applications
14. Introduction to Jaggery
• Like JSP/ PHP, but user writes code completely in javascript
(Data access / Business Logic / UI)
• Runs as a Web app (e.g. tomcat)
• Runs on top of Java
• Provides very close integration with WSO2 Products (e.g.
Users, Web service calls, access to the registry, access
OSGI services etc. )
15. First Look {jaggery.js}
Nothing complex
If (you are familiar with WSO2)
{
server runtimes, it’s the same thing
}
Else
{
extract the zip, run
sh /bin/server.sh/.bat
}
http://dist.wso2.org/snapshots/maven2/org/jaggeryjs/jaggery/0.9.0-SNAPSHOT/jaggery-0.9.0-20140321.143805-240.zip
16. Hello Jaggery!!
• Most straight forward Sample
• Open up a text editor
• Create {JAGGERY_HOME}/apps/carshop/hello.jag
• Browser to :http://localhost:9763/carshop/hello.jag
32. Including 3rd party js libraries
• {{ mustache }}
• Handlebars.js
• base64 js
33. Java and Jaggery
• Writing HostObject for Jaggery
• Java Class accessing
http://madhukaudantha.blogspot.com/2014/02/writing-hostobject-for-jaggery.html
39. Develop RESTful Service & Routering
• URL Mapping
Using inbuilt jaggery.conf
• Front End Controller Concept
Application.serve()
var pipe=require('pipe');
var router=require('router');
pipe.plug(router);