зеркало из https://github.com/Azure/ms-rest-js.git
Merge remote-tracking branch 'upstream/master' into port-core-http-pr8803
This commit is contained in:
Коммит
be3aeefd95
|
@ -1,2 +1,2 @@
|
|||
# Default owners
|
||||
* @daviwil @ramya-rao-a @sergey-shandar
|
||||
* @ramya-rao-a @jeremymeng @xirzec
|
||||
|
|
13
README.md
13
README.md
|
@ -5,20 +5,21 @@
|
|||
Runtime for isomorphic javascript libraries (that work in the browser and node.js environment) generated via [Autorest](https://github.com/Azure/Autorest).
|
||||
|
||||
## Requirements
|
||||
- node.js version > 6.x
|
||||
- npm install -g typescript
|
||||
- Node.js version > 6.x
|
||||
- `npm install -g typescript`
|
||||
|
||||
## Installation
|
||||
- After cloning the repo, execute `npm install`
|
||||
|
||||
## Execution
|
||||
|
||||
### node.js
|
||||
- Set the subscriptionId and token
|
||||
- Run `node samples/node-sample.js`
|
||||
### Node.js
|
||||
- Set the subscriptionId and token as instructed in `samples/node-samples.ts`
|
||||
- Run `npx ts-node samples/node-sample.js`
|
||||
|
||||
### In the browser
|
||||
- Set the subscriptionId and token and then run
|
||||
- Run `npm run build`
|
||||
- Set the subscriptionId and token then
|
||||
- Open index.html file in the browser. It should show the response from GET request on the storage account. From Chrome type Ctrl + Shift + I and you can see the logs in console.
|
||||
|
||||
## Architecture Overview
|
||||
|
|
|
@ -3,10 +3,9 @@
|
|||
|
||||
<head>
|
||||
<title>My Todos</title>
|
||||
<script type="text/javascript" src="../msRestBundle.js"></script>
|
||||
<script type="text/javascript" src="../dist/msRest.browser.js"></script>
|
||||
<script type="text/javascript">
|
||||
document.write('hello world');
|
||||
const msRest = className;
|
||||
const subscriptionId = "00977cdb-163f-435f-9c32-39ec8ae61f4d";
|
||||
const token = "token";
|
||||
const creds = new msRest.TokenCredentials(token);
|
||||
|
|
|
@ -2,18 +2,16 @@
|
|||
|
||||
import * as msRest from "../lib/msRest";
|
||||
const clientOptions: msRest.ServiceClientOptions = {
|
||||
requestPolicyFactories: [msRest.logPolicy()]
|
||||
// add log policy to list of default factories.
|
||||
requestPolicyFactories: (factories) => factories.concat([msRest.logPolicy()])
|
||||
};
|
||||
|
||||
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"] || "subscriptionId";
|
||||
// An easy way to get the token
|
||||
// 1. Go to this test drive link https://azure.github.io/projects/apis and authenticate by clicking on Authorize. Check the user impersoantion checkbox in the popup.
|
||||
// 1.1 select a subscription of your choice
|
||||
// 1.2 select the storage-2015-06-15 option from the first drop down list
|
||||
// 1.3 expand the url to list storage accounts in a subscription
|
||||
// 1.4 click on try it out button.
|
||||
// 1.5 in the curl tab you will see the actual curl request that has the bearer token in it
|
||||
// 1.6 copy paste that token here. That token is valid for 1 hour
|
||||
// An easy way to get the token using Azure CLI (https://docs.microsoft.com/cli/azure/?view=azure-cli-latest)
|
||||
// 1. `az login` using the above subscription
|
||||
// 2. `az account set -s <subscription id>`
|
||||
// 3. `az account get-access-token --resource=https://management.azure.com`
|
||||
// 4. copy paste that token here. That token is valid for 1 hour
|
||||
const token = process.env["ACCESS_TOKEN"] || "token";
|
||||
const creds = new msRest.TokenCredentials(token);
|
||||
const client = new msRest.ServiceClient(creds, clientOptions);
|
||||
|
|
Загрузка…
Ссылка в новой задаче