Skip to content

Commit 8105297

Browse files
committed
Removed the "data" REST API. It's not needed now that I've merged image and web templates in Data-Forge Plot.
1 parent ede2a9d commit 8105297

File tree

4 files changed

+13
-14
lines changed

4 files changed

+13
-14
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ By convention you need an index.html to be the main web page. You can have any n
2323

2424
This repository contains an example template under the test-template directory. Please use this to understand the basics of how a template is constructed.
2525

26+
A template can contain a template.json configuration file and a test-data.json. Both files by convention are omitted from the expanded template.
27+
28+
template.json must contain a field 'waitSelector' that specifies the element/tag that must appear in the DOM before the image or PDF file can be captured.
29+
30+
When using the 'renderImage' function a 'captureSelector' field can optionally specify the root element to be captured. If tonot specified the the 'waitSelector' field is used instead. 'captureSelector' is ignored for PDF capture, PDF capture automatically captures the entire web page.
31+
2632
## Programmatic Usage
2733

2834
### Installation

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "capture-template",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "This library is responsible for expanding a template web page and then capturing it PNG or PDF.",
55
"main": "build/index.js",
66
"types": "build/index.d.ts",
@@ -34,7 +34,7 @@
3434
"chai": "4.1.2",
3535
"express": "^4.16.3",
3636
"fs-extra": "^7.0.0",
37-
"inflate-template": "^1.0.0",
37+
"inflate-template": "^1.0.1",
3838
"nightmare": "^3.0.1",
3939
"promisify-any": "^2.0.1",
4040
"yargs": "^12.0.1"

src/web-server.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as express from "express";
22
import * as http from 'http';
33
import * as path from "path";
4-
import { ITemplate } from "../../export/build";
4+
import { ITemplate } from 'inflate-template';
55

66
/**
77
* Web-server component. Serves the chart interative chart.
@@ -70,7 +70,6 @@ export class WebServer implements IWebServer {
7070
if (cachedFileContent) {
7171
return cachedFileContent;
7272
}
73-
7473
const fileSystemPath = path.join(...url.split('/'));
7574
const templateFile = template.find(fileSystemPath);
7675
if (!templateFile) {
@@ -107,13 +106,7 @@ export class WebServer implements IWebServer {
107106
response.sendStatus(404);
108107
}
109108
});
110-
111-
app.get("/data", (request, response) => {
112-
response.json({
113-
data: data,
114-
});
115-
});
116-
109+
117110
this.server.listen(this.requestedPortNo, (err: any) => {
118111
if (err) {
119112
reject(err);

0 commit comments

Comments
 (0)