40c6f750a9
Update README.md with correct support links |
||
---|---|---|
.pipelines | ||
.vscode | ||
src | ||
test | ||
.gitignore | ||
.travis.yml | ||
CONTRIBUTING.md | ||
LICENSE | ||
README.md | ||
SECURITY.md | ||
gulpfile.js | ||
karma.conf.js | ||
package.json | ||
tsconfig.json | ||
tslint.json | ||
typings.json | ||
webpack.config.js | ||
webpack.test.config.js | ||
webpack.test.tsconfig.json |
README.md
powerbi-router
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.
Documentation:
https://microsoft.github.io/powerbi-router
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);
/**
* Demonstrate 'syncrhonous' API with request and response.
*/
router.get('/report/pages', (request, response) => {
return app.getPages()
.then(pages => {
response.send(200, pages);
});
});
/**
* Demonstrate 'asynchronous' API with accepted command, and events
*/
router.put('/report/pages/active', (request, response) => {
const page = request.body;
return app.validatePage(page)
.then(() => {
app.setPage(request.body)
.then(page => {
hpm.post(`/report/${reportId}/events/pageChanged`, page);
}, error => {
hpm.post(`/report/${reportId}/events/error`, error);
});
response.send(202);
}, errors => {
response.send(400, errors);
});
});
/**
* Demonstrate using path parameters and query parameters
*/
router.put('/report/pages/:pageName/visuals?filter=true', (request, response) => {
const pageName = request.params.pageName;
const filter = request.queryParams.filter;
return app.validatePage(pageName)
.then(() => {
return app.getVisuals(filter)
.then(visuals => {
response.send(200, visuals);
}, error => {
response.send(500, error);
});
}, errors => {
response.send(400, errors);
});
});
/**
* Demonstrate using wildcard matching
*/
router.get('*notfound', (request, response) => {
response.send(404, `Not Found. Url: ${request.params.notfound} was not found.`);
});
Support
- Feature Requests: Submit your ideas and suggestions to the Fabric Ideas Portal, where you can also vote on ideas from other developers.
- Bug Reports and Technical Assistance: Visit the Fabric Developer Community Forum. Our team and community experts are ready to assist you.
- Additional Support: Contact your account manager or reach out to the Fabric Support Team.