Need a special offer?Find out if your project fits.
+
All documentation
  • Introduction
  • Connecting to Data Source
    1. Supported data sources
    2. Connecting to other data sources
  • Browser compatibility
  • Documentation for older versions
  • A quick overview of a sample Node.js server

    We have prepared a sample Node.js server that implements the 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 sample Node.js server

    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

    Run the sample Node.js server

    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.

    Configure the report

    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.

    What's next?

    You may be interested in the following articles: