jsreport / jsreport-typescript-example

Examples how to use typescript with jsreport
https://jsreport.net
MIT License
5 stars 2 forks source link

jsreport-typescript-example

This repository contains a set of examples of using typescript with jsreport. The jsreport types are stored DefinitelyTyped general repository and you will typically want to explicitly install them to your projects. The most common are:

@types/jsreport - should contain types of all extensions delivered in the main jsreport distribution
@types/jsreport-client - should contain types of all extensions delivered in the main jsreport distribution and types for the nodejs client

You can build the examples using the following commands. The commands for running examples are listed below.

npm i
npm run watch

The types don't cover 100% of jsreport yet. Please help us by contributing to the DefinitelyTyped.

jsreport client example

This example stored in src/client.ts creates an internal jsreport server for testing purpose and invokes rendering remotely using nodejs jsreport client.

Start it using:

npm run client

jsreport server example

The most simple way how to start jsreport reporting server. See src/server.ts.

Start it using the following command and reach the running server on port 5488

npm run server

jsreport and express integration example

A standard nodejs express app with integrated jsreport running on the nested route. See src/integrated.ts.

Start it using the following command and reach the running express app on http://localhost:3000

npm run integrated

jsreport stateless examples

jsreport can be used also in the stateless mode. This means you can specify fully the rendering request without using the template store. See src/stateless.ts.

Start it using the following command, it should write file out.pdf

npm run stateless