Hi
I wonder if jsreport can used without running it as a server.
In my case I have a backend (nest.js) with some api’s used by my frontend (quasar.js). My backend, when running locally on my machine, everything works just fine, using the jsreport package and initializing jsreport like this:
static async init(port: number) {
this._jsReporter = new jsreport.Reporter({
httpPort: port,
httpsPort: null,
authentication: {
enabled: false
}
})
this._jsReporter.init().then(() => {
console.log('\x1b[32mReporter\x1b[0m is listening on port', this._port)
this._ready = true
})
}
and render reports like this:
if (this._ready) return this._jsReporter.render( { template: { … } } ) // Returns a PDF file
else { ... }
But when I deploy to Azure (as a Web App), my backend fails when calling jsReport.init(), with errors related to the port I use, it seems.
I wonder, if jsReport can be used without having it running as a Server, but e.g. just as function like this:
import * as jsreport from 'jsreport'
const options = { ... }
return jsreport.render( { template: { … } }, options ) // Returns a PDF file
Where no port in options are needed. That would be super simple (and cool).
Thanks for any advise.