{"id":18812487,"url":"https://github.com/jsreport/jsreport-express","last_synced_at":"2025-04-13T21:23:47.799Z","repository":{"id":57286247,"uuid":"45617981","full_name":"jsreport/jsreport-express","owner":"jsreport","description":"jsreport extension adding API and studio","archived":false,"fork":false,"pushed_at":"2021-08-20T16:45:07.000Z","size":4738,"stargazers_count":6,"open_issues_count":1,"forks_count":4,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-11-04T11:02:21.776Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://jsreport.net/learn/api","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jsreport.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-05T14:54:11.000Z","updated_at":"2021-08-20T16:45:09.000Z","dependencies_parsed_at":"2022-09-10T01:01:19.829Z","dependency_job_id":null,"html_url":"https://github.com/jsreport/jsreport-express","commit_stats":null,"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsreport%2Fjsreport-express","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsreport%2Fjsreport-express/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsreport%2Fjsreport-express/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsreport%2Fjsreport-express/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jsreport","download_url":"https://codeload.github.com/jsreport/jsreport-express/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223606409,"owners_count":17172663,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T23:33:42.685Z","updated_at":"2024-11-07T23:33:43.308Z","avatar_url":"https://github.com/jsreport.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"**⚠️ This repository has been moved to the monorepo [jsreport/jsreport](https://github.com/jsreport/jsreport)**\n--\n\n# jsreport-express\n[![NPM Version](http://img.shields.io/npm/v/jsreport-express.svg?style=flat-square)](https://npmjs.com/package/jsreport-express)\n[![Build Status](https://travis-ci.org/jsreport/jsreport-express.png?branch=master)](https://travis-ci.org/jsreport/jsreport-express)\n\n\u003e jsreport extension adding API and studio\n\n`jsreport-express` is the main extension you need when you want to add jsreport studio or API. Many other extensions works in conjunction with `jsreport-express` and extends studio ui or API. Just to name some of them:\n\n- [jsreport-templates](https://github.com/jsreport/jsreport-templates)\n- [jsreport-data](https://github.com/jsreport/jsreport-data)\n- [jsreport-scripts](https://github.com/jsreport/jsreport-scripts)\n- [jsreport-statistics](https://github.com/jsreport/jsreport-statistics)\n- [jsreport-authentication](https://github.com/jsreport/jsreport-authentication)\n\nAnd many others. Where some of them are working also without `jsreport-express` and some of them doesn't.  This extension is designed to be just a wrapper for ui and it doesn't work standalone. The minimal configuration requires at least [jsreport-templates](https://github.com/jsreport/jsreport-templates) to be installed.\n\n## jsreport-core\nThe following example shows how to start jsreport studio through express extension.\n```js\nvar jsreport = require('jsreport-core')();\njsreport.use(require('jsreport-templates')());\njsreport.use(require('jsreport-express')({ httpPort: 2000}));\n\njsreport.init();\n```\n\n### Attach to existing express app\n`jsreport-express` by default creates a new express.js application and starts to listen on specified port. In some cases you may rather use your own express.js app and just let `jsreport-express` to add specific routes to it. This can be done in the following way:\n```js\nvar express = require('express');\n\nvar app = express();\n\napp.get('/', function (req, res) {\n  res.send('Hello from the main application');\n});\n\nvar reportingApp = express();\napp.use('/reporting', reportingApp);\n\nvar jsreport = require('jsreport-core')();\njsreport.use(require('jsreport-templates')());\njsreport.use(require('jsreport-express')({ app: reportingApp }));\n\njsreport.init();\napp.listen(3000);  \n```\n\n## jsreport\nYou can use the same technique in the full distribution of jsreport or with the auto discovered extensions:\n```js\nvar express = require('express');\nvar app = express();\n\napp.get('/', function (req, res) {\n  res.send('Hello from the main application');\n});\n\nvar reportingApp = express();\napp.use('/reporting', reportingApp);\n\nvar jsreport = require('jsreport')({\n  extensions: {\n    express: { app: reportingApp }\n  }\n});\n\njsreport.init();\napp.listen(3000);\n```\n\n## Configuration\n\n`jsreport-express` uses some options from the global configuration:\n\n`httpPort` (number) - http port on which is jsreport running, if both httpPort and httpsPort are specified, jsreport will automaticaly create http redirects from http to https, if any of httpPort and httpsPort is specified default process.env.PORT will be used\n\n`httpsPort` (number) - https port on which jsreport is running\n\n`appPath` (string) - optionally set application path, if you run application on http://appdomain.com/reporting then set \"/reporting\" to `appPath`. The default behavior is that it is assumed that jsreport is running behind a proxy, so you need to do url url rewrite /reporting -\u003e / to make it work correctly, See `mountOnAppPath` when there is no proxy + url rewrite involved in your setup.\n\n`mountOnAppPath` (boolean) - use this option along with `appPath`. it specifies if all jsreport routes should be available with appPath as prefix, therefore making `appPath` the new root url of application\n\n`certificate` object - path to key and cert file used by https\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjsreport%2Fjsreport-express","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjsreport%2Fjsreport-express","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjsreport%2Fjsreport-express/lists"}