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.
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. The file name matches the index
property of the dataSource
configuration object.
Download the .zip
archive with the sample project or clone it from GitHub with the following command:
git clone https://github.com/flexmonster/api-data-source
cd api-data-source
To start the server, run the following commands in a console:
cd server-nodejs
npm install
npm start
On the client side (see /client/index.html
), the report is configured as follows:
new Flexmonster({
container: "pivotContainer",
report: {
dataSource: {
type: "api",
url: "http://localhost:3400/api/cube",
index: "fm-product-sales"
}
}
});
You may be interested in the following articles: