Giter Site home page Giter Site logo

brijrajsingh / nodejs-powerbi-embedded-sample Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 2.0 146 KB

A Sample nodejs application to show usage of PowerBiClient SDK and PowerBI SDK for NodeJS

License: MIT License

JavaScript 25.07% CSS 53.76% HTML 21.16%

nodejs-powerbi-embedded-sample's Introduction

nodejs-PowerBI-Embedded-Sample

A Sample nodejs application to show usage of PowerBiClient SDK and PowerBI SDK for NodeJS

The application is a basic NodeJS application (Express based), it uses Power BI client for nodeJS (https://microsoft.github.io/PowerBI-JavaScript/) and Power BI NPM Package at server side (https://github.com/Microsoft/PowerBI-Node )

In app.js A JWT token is generated with the help of PowerBI SDK for NodeJS

var token = powerbi.PowerBIToken.createReportEmbedToken('WorkspaceCollection', 'workspaceId', 'reportId');

var jwtoken = token.generate('accessKey');

This JWT token is passed to the html page in a variable

res.render('index.html', { title: 'PowerBI Report',jwt:jwtoken });

In index.html

<script src="powerbi.min.js"></script>

Include the PowerBI client sdk min file (you can also include this file directly from bower distribution folder).

`<div id="myReport" powerbi-type="report" powerbi-embed-url="https://embedded.powerbi.com/appTokenReportEmbed?reportId=REPORTID" powerbi-access-token=<%- JSON.stringify(jwt) %> style="height: 600px;"

`

set the powerbi-embed-url attribute with ReportId, also set the powerbi-access-token returned from the server side in jwt variable.

in the doinit function call, call the powerbi.embed function with myReport element.

<script type="text/javascript"> function doinit(){ var element = document.getElementById('myReport'); var report = powerbi.embed(element); console.log("initDOne") } </script>

nodejs-powerbi-embedded-sample's People

Contributors

brijrajsingh avatar

Stargazers

 avatar Adelino Pereira avatar  avatar Cleyton Brasil avatar

Watchers

James Cloos avatar  avatar

nodejs-powerbi-embedded-sample's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.