https://github.com/jsreport/jsreport-typescript-example
Examples how to use typescript with jsreport
https://github.com/jsreport/jsreport-typescript-example
Last synced: about 1 year ago
JSON representation
Examples how to use typescript with jsreport
- Host: GitHub
- URL: https://github.com/jsreport/jsreport-typescript-example
- Owner: jsreport
- License: mit
- Created: 2020-09-08T16:03:19.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2024-10-09T06:59:15.000Z (over 1 year ago)
- Last Synced: 2025-03-27T11:43:36.346Z (about 1 year ago)
- Language: Handlebars
- Homepage: https://jsreport.net
- Size: 526 KB
- Stars: 6
- Watchers: 4
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# jsreport-typescript-example
This repository contains a set of examples of using typescript with jsreport.
The jsreport types are stored [DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped) general repository and you will typically want to explicitly install them to your projects. The most common are:
[@types/jsreport](https://www.npmjs.com/package/@types/jsreport) - should contain types of all extensions delivered in the main jsreport distribution
[@types/jsreport-client](https://www.npmjs.com/package/@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](https://github.com/DefinitelyTyped/DefinitelyTyped).**
## jsreport client example
This example stored in [src/client.ts](src/client.ts) creates an internal jsreport server for testing purpose and invokes rendering remotely using [nodejs jsreport client](https://jsreport.net/learn/nodejs-client).
Start it using:
```
npm run client
```
## jsreport server example
The most simple way how to start jsreport reporting server. See [src/server.ts](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](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](src/stateless.ts).
Start it using the following command, it should write file out.pdf
```
npm run stateless
```