05 Jun 2013
Absolute.js for JaggeryJS
The objective of absolute.js is to handle front-end development work with simplicity and conventions inside jaggeryJS. So let’s get to the facts quick.
First we have to redirect all the requests from jaggery configuration file to a jag file.
Inside the index.jag file we will setup absolute.js and give a configuration. Also note that defaults are handled inside absolute.js.
Now absolute.js is ready for request processing.
First we have to look into the folder layout -
The concept of mvc is simple. We have a model, a view and a controller. In our example app we haven’t followed a model approach to data (Note: This is also very simple since JSON and database library bridge exists in jaggery).
A Request procedure
The request comes to the absolute.js module. If the requst URI is - ’/publisher/console/list’
* '/publisher' is the context of the app * '/console' is the controller * '/list' is the view
Controllers are contained in the controller folder of the context application. The controller is created with the same name. Inside the controller it will have a function named after the view. absolute.js will execute this function and the return json object will be provided to the template engine.
I am currently working on the layout and partials handling inside absolute.js.
Note:- Initial credit of the idea of building a simple mvc framework for jaggery goes to Dilan
Till next time mate,
Dulitha at 10:53