A lightweight router for the Power BI JavaScript SDK which allows a hosting application to register routes to extend and integrate with Power BI embedded components.
Перейти к файлу
Wallace Breza c47bdbf3f4 Added travis build status image 2016-06-30 08:00:25 -07:00
.vscode Update test task and CONTRIBUTING.md with correct build task and repo url 2016-06-27 16:42:48 -07:00
src Fix bug which invoked handler for incorrect route. 2016-06-23 13:12:39 -07:00
test Change import namespace to Router to be more consistent with typical usage. 2016-06-23 13:12:39 -07:00
.gitignore Add coverage reporting by default and exclude coverage folder in ignore files 2016-06-23 13:12:39 -07:00
.travis.yml Add .travis.yml 2016-06-29 18:13:14 -07:00
CONTRIBUTING.md Update test task and CONTRIBUTING.md with correct build task and repo url 2016-06-27 16:42:48 -07:00
LICENSE Initial Commit. Setup powerbi-router project with build and tests 2016-06-23 13:12:39 -07:00
README.md Added travis build status image 2016-06-30 08:00:25 -07:00
gulpfile.js Update header generation to use webpack Banner plugin to fix source maps 2016-06-29 18:14:51 -07:00
karma.conf.js Add route-recognizer and restructure tests. 2016-06-23 13:12:39 -07:00
package.json Add files property to package.json to only package dist folder 2016-06-28 14:51:31 -07:00
tsconfig.json Refactor tsconfig for build and e2etest to remove warnings and automatically output .d.ts in correct location 2016-06-23 13:12:39 -07:00
typings.json Add route-recognizer and restructure tests. 2016-06-23 13:12:39 -07:00
webpack.config.js Change webpack.config to enforce using package name as library name 2016-06-28 14:51:13 -07:00
webpack.test.config.js Rename tsconfig and webpack configs related to testing to be consistent with type of test and other projects. Add task to generate custom dts with no exports 2016-06-23 13:12:39 -07:00
webpack.test.tsconfig.json Rename tsconfig and webpack configs related to testing to be consistent with type of test and other projects. Add task to generate custom dts with no exports 2016-06-23 13:12:39 -07:00

README.md

powerbi-router

Build Status

Router for Microsoft Power BI. Given an http method and url pattern call the matching handler with the request and response object. Syntax matches common libraries such as express and restify. This library uses Route-recognizer to handle pattern matching such as /root/path/:name where name will be passed as paramter to the handler.

Installation:

npm install --save powerbi-router

Usage:

import * as Wpmp from 'window-post-message-proxy';
import * as Router from 'powerbi-router';

const wpmp = new Wpmp.WindowPostMessageProxy();
const router = new Router.Router(wpmp);

router.get('/report/pages', (request, response) => {
  return app.getPages()
    .then(pages => {
      response.send(200, pages);
    });
});

router.put('/report/pages/active', (request, response) => {
  app.setPage(request.body)
    .then(page => {
      host.sendEvent('pageChanged', page);
    });
    
  response.send(202);
});