Hi Chan,
Good stuff we badly need it but constrained by resources :( Lets work
together on getting this right. our idea is to have a syntax like following
[1]. but we need to register these at app deployment level like in JAX-RS.
lets chat on this Monday. Manu/Ruchira also has some ideas on the subject
please drop by the jaggery team, lets work on a solution and commit
directly to Jaggery as an inbuilt module
[1]
<%
(function() {
importPackage(Packages.org.wso2.jaggery.admin);
var rest = require("/modules/restMaper.js");
rest.register('/{context}/store/{username}', function(uername) {
var content = parse(request.getContent());
userManager.addUser(username, json.credential, json.roleList,
json.claims, json.profileName);
return;
});
rest.register('/{context}?user={user}', function(user) {
var ret = userM.isExistingUser(user);
print(ret);
return;
});
}());
%>
Regards,
/Nuwan
On Sat, May 11, 2013 at 9:05 PM, Chan <[email protected]> wrote:
> Hi all,
>
> While developing the REST- API for the MDM backend we faced with a dilemma
> of mapping URLs.
>
> We have a module call
> Router<https://gist.github.com/dulichan/62f3d49d1fe40a11b4c7#file-router-jsa>that
> will take the request object and traverse through a set of routes to
> match the give REST API call. Seamless mapping of URL, method and data
> occurs underneath the module.
>
> Compared to the previous style (used in the Coffeeshop
> example<https://gist.github.com/dulichan/62f3d49d1fe40a11b4c7#file-previousstyle-js>)
> the new
> style<https://gist.github.com/dulichan/62f3d49d1fe40a11b4c7#file-gistfile1-js>using
> the Router module is much cleaner and easier to use.
>
> Using the Router module - a route mapped would look like below -
> jbj.route('users/{userid}|GET',function(ctx){});
>
> Later improvement were done according to Gayan where we need to handle
> three types of data -POST raw data, GET parameter data and POST JSON data.
> The initial idea to develop the component is from
> sinatra<http://www.sinatrarb.com/intro.html>
> .
>
> What are your thoughts about this routing module for jaggery?
>
> Thanks.
> --
> Chan (Dulitha Wijewantha)
> Software Engineer - Mobile Development
> WSO2Mobile
> Lean.Enterprise.Mobileware
> * ~Email [email protected]*
> * ~Mobile +94712112165*
> * ~Website dulithawijewantha.com
> *
> * ~Blog blog.dulithawijewantha.com
> *
> * ~Twitter @dulitharw <https://twitter.com/dulitharw>*
>
> _______________________________________________
> Architecture mailing list
> [email protected]
> https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
>
>
--
*Thanks & Regards,
Nuwan Bandara
Associate Technical Lead & Member, MC, Development Technologies
WSO2 Inc. - lean . enterprise . middleware | http://wso2.com
blog : http://nuwanbando.com; email: [email protected]; phone: +94 11 763 9629
*
<http://www.nuwanbando.com/>
_______________________________________________
Architecture mailing list
[email protected]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture