exporess app vs jsreport prod.config.json



  • I've got a small express app which is basically similiar to the one I've found here https://jsreport.net/learn/adapting-jsreport#attach-to-existing-express-app

    I would like to know whether my prod.config.json configuration works the same way as it was used by standalone jsreport app? To be more precisely I mean tasks, and phantom strategy, numerOfWorkers - are they going to work as it supposed to or do I have to handle it somehow on my own?

    Maybe it'a a dumb question but it's my first nodejs app and I'm a little bit confused.

    "phantom": {
          "strategy": "phantom-server",
          "numberOfWorkers": 2,
          "timeout": 60000,
          "defaultPhantomjsVersion": "2.1.1"
     },
     "tasks": {
         "strategy": "in-process",
         "timeout": 10000,
         "numberOfWorkers": 2,
         "allowedModules": []
     }

  • administrators

    hi! yes, it should work the same if you are not changing the rootDirectory config when creating the jsreport instance in your code. to know what config file jsreport is picking just check the logs in your console when starting the app, you should see a line like the following

    Initializing jsreport@1.9.1 in development mode using configuration file: dev.config.json 
    

    be aware that jsreport will only pick the prod.config.json file if your app is started with NODE_END env var set to production



  • Just adding my 2 cents here.

    The new configuration documentation covers the file usage quite well. Take a look.
    You should also be able to see what strategy (dedicated-process vs phantom-server) is being used in the output logs.

    +476    Executing recipe phantom-pdf
    +4096   Converting in http server based phantomjs 1.9.8
    

Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.