Friday 19 May 2017

Creating reports in Angular or Node? Generate HTML clientside or serverside?

I have to do 18 different long complex reports with a lot of data. The reports are for print and PDF so there is no user interaction.

At the moment I do it like this.

index.html only contains this:

<div ng-controller="reportAgentSaleController">
    <div id="contentAll"></div>
</div>

In the angular controller I send a lot of requests to my nodejs routes to get data from MongoDB and with that data I generate all the HTML code client side.

My only problem here is that it is really hard for me to do in the angular controller when you call so many node routes and many of these routes are dependent on each other and everything is async, so I end up with a maze of promises and callback trees.

I am considering moving everything into the nodejs controller and generate all HTML code there instead, and then parse the entire finished HTML report to angular. (kind of what you would do with PHP or .Net etc. where you generate the entire page server side)

What do you guys think? Has anyone out there done big reports in angular where you actually do not use angulars strengths (because there is no user interaction)?

Or is there a whole other way to do this?

I would love to hear from someone with more experience (i'm pretty new at this).



via torbenrudgaard

No comments:

Post a Comment