We have prepared a sample Node.js server that implements the Flexmonster custom data source API. It is available in the server-nodejs/
folder in the api-data-source GitHub repository.
The sample Node.js server implements version 2.8.5 of the custom data source API.
Download the .zip
archive with the sample server or clone it from GitHub with the following command:
git clone https://github.com/flexmonster/api-data-source
To start the server, run the following commands in a console:
cd api-data-source/server-nodejs npm install npm start
All requests from Flexmonster Pivot Table are handled by the http://localhost:3400/api/cube
endpoint.
Raw data is stored in JSON format in the server-nodejs/data/
folder.
On the client side (see /client/index.html
), the report should be configured as follows:
new Flexmonster({ container: "pivotContainer", componentFolder: "node_modules/flexmonster/", report: { dataSource: { type: "api", url: "http://localhost:3400/api/cube", index: "fm-product-sales" } } });
The dataSource.index
property matches the name of the JSON file from the server-nodejs/data/
folder.
You may be interested in the following articles: