jsreport-express
jsreport extension adding API
Last updated 4 months ago by bjrmatos .
LGPL · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install jsreport-express 
SYNC missed versions from official npm registry.

jsreport-express

NPM Version Build Status

jsreport extension adding API and studio

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:

And 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 to be installed.

jsreport-core

The following example shows how to start jsreport studio through express extension.

var jsreport = require('jsreport-core')();
jsreport.use(require('jsreport-templates')());
jsreport.use(require('jsreport-express')({ httpPort: 2000}));

jsreport.init();

Attach to existing express app

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:

var express = require('express');

var app = express();

app.get('/', function (req, res) {
  res.send('Hello from the main application');
});

var reportingApp = express();
app.use('/reporting', reportingApp);

var jsreport = require('jsreport-core')();
jsreport.use(require('jsreport-templates')());
jsreport.use(require('jsreport-express')({ app: reportingApp }));

jsreport.init();
app.listen(3000);  

jsreport

You can use the same technique in the full distribution of jsreport or with the auto discovered extensions:

var express = require('express');
var app = express();

app.get('/', function (req, res) {
  res.send('Hello from the main application');
});

var reportingApp = express();
app.use('/reporting', reportingApp);

var jsreport = require('jsreport')({
  extensions: {
    express: { app: reportingApp }
  }
});

jsreport.init();
app.listen(3000);

Configuration

jsreport-express uses some options from the global configuration:

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

httpsPort (number) - https port on which jsreport is running

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 -> / to make it work correctly, See mountOnAppPath when there is no proxy + url rewrite involved in your setup.

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

certificate object - path to key and cert file used by https

Current Tags

  • 2.6.0                                ...           latest (4 months ago)
  • 1.0.1                                ...           next (4 years ago)

31 Versions

  • 2.6.0                                ...           4 months ago
  • 2.5.0                                ...           10 months ago
  • 2.4.0                                ...           a year ago
  • 2.3.1                                ...           a year ago
  • 2.3.0                                ...           a year ago
  • 2.2.4                                ...           2 years ago
  • 2.2.3                                ...           2 years ago
  • 2.2.2                                ...           2 years ago
  • 2.2.1                                ...           2 years ago
  • 2.2.0                                ...           2 years ago
  • 2.1.1                                ...           2 years ago
  • 2.1.0                                ...           2 years ago
  • 2.0.0                                ...           2 years ago
  • 1.2.4                                ...           3 years ago
  • 1.2.3                                ...           3 years ago
  • 1.2.2                                ...           3 years ago
  • 1.2.1                                ...           3 years ago
  • 1.2.0                                ...           3 years ago
  • 1.1.0                                ...           3 years ago
  • 1.0.2                                ...           4 years ago
  • 1.0.1                                ...           4 years ago
  • 1.0.0                                ...           4 years ago
  • 0.3.2                                ...           4 years ago
  • 0.3.1                                ...           4 years ago
  • 0.3.0                                ...           4 years ago
  • 0.2.1                                ...           5 years ago
  • 0.2.0                                ...           5 years ago
  • 0.1.2                                ...           5 years ago
  • 0.1.1                                ...           5 years ago
  • 0.1.0                                ...           5 years ago
  • 0.0.1                                ...           5 years ago
Maintainers (2)
Downloads
Today 1
This Week 1
This Month 1
Last Day 0
Last Week 0
Last Month 2
Dependencies (8)
Dev Dependencies (11)

Copyright 2014 - 2016 © taobao.org |