I am mixing both client and server side code according to my need.

All the json data loaded into angular is made through *Restangular *calls 
to a controler 'api.py'.
In that api controller I have several functions, all with the 
'@request.restful()' decorator. Inside each of them I import a module and 
from the modules logic code is executed (all the DAL manipulations). Then 
json data is returned.
I does work very well :)

For the angular views (directives or ui-router), if I can manage to have 
all the processing done on the server I try to do that first. 
Angular *views*:
I call the controller/function as usual and return a dict() with any server 
processing.

Angular *templates*:
I call a 'templates.py' controller with different functions (corresponding 
to angular modules). According to the args passed to the function I change 
the 'response.view' and get all the web2py Views magic (DAL and T mainly 
for now. Maybe SQLForm once I dive in the LOAD() method). If I don't need 
any server processing I load a template from the static folder (if needed I 
call the api above to fetch some data).

If I am not wrong, each 'hit' to the api.py controller is the same as a 
full page reload, from the web2py perspective. Am I correct?

Thanks for all the insights
Sébastien.
  

On Thursday, 16 April 2015 02:46:08 UTC+2, Richard wrote:
>
> Ok, you are right... I only said that as long as that page not reload and 
> he call web2py functions which are not requesting a new page load it will 
> reduce the amount of server side processing since the function call will 
> have limited web2py API call...
>
> Richard
>
> On Wed, Apr 15, 2015 at 6:35 PM, Niphlod <nip...@gmail.com <javascript:>> 
> wrote:
>
>> this is the uttmost unproper and biased statement I've seen in a while. 
>> Angular doesn't make your app fast by default, and neither snappier, and 
>> neither more resource-friendly on the server. If you're good with Angular 
>> you're just pushing your logic client-side, and avoiding page reloads. This 
>> doesn't impact performances AT ALL on the server-side.
>> BTW: Hopefully you're not pushing your entire "smart code bits" of the 
>> app client-side, either it'll be copied away in a split second. If your 
>> assumptions are that moving the UI and unimportant parts of your app to the 
>> client makes your backend faster.......well, you have too much unimportant 
>> code in your app.
>>
>> On Thursday, April 16, 2015 at 12:02:12 AM UTC+2, Richard wrote:
>>>
>>> Wait if you use Angular you won't really need to care about performance 
>>> issue before a lot of time... Since you are not going to experiment be 
>>> performance issue except when you reload page...
>>>
>>  -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+un...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to