Using with Express
Our sample projects and report templates can help you learn the basics of working with our products.An Express server can host the Dashboards.JS viewer page and serve dashboard templates from its own routes.
Build the viewer in the served page.
How it works. Express acts as the static and template host while the viewer runs in the browser, keeping the server role to routing and file delivery.
Build the viewer in the served page.
<script src="stimulsoft.reports.js"></script>
<script src="stimulsoft.dashboards.js"></script>
<script src="stimulsoft.viewer.js"></script>
<script>
var options = new Stimulsoft.Viewer.StiViewerOptions();
options.appearance.fullScreenMode = true;
var viewer = new Stimulsoft.Viewer.StiViewer(options, "StiViewer", false);
viewer.renderHtml("viewer");
var report = Stimulsoft.Report.StiReport.createNewDashboard();
report.loadFile('/dashboard'); // served by an Express route
viewer.report = report;
</script>- Express serves both the static Dashboards.JS scripts and the viewer HTML page.
report.loadFile('/dashboard')— loads the template from an Express route, so the server controls which dashboard is delivered.
How it works. Express acts as the static and template host while the viewer runs in the browser, keeping the server role to routing and file delivery.