Skip to content

Commit

Permalink
docs(getting started): rearranged getting started doc and fixed a cou…
Browse files Browse the repository at this point in the history
…ple typos
  • Loading branch information
jgravois committed Feb 28, 2018
1 parent 78512a3 commit 3d5b371
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 85 deletions.
21 changes: 21 additions & 0 deletions docs/src/guides/babel-and-rollup.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,24 @@ group: 1-get-started
---

# Get Started with Babel and Rollup

ArcGIS REST JS is ready-to-use with popular module bundlers like [webpack](https://webpack.js.org/) and [rollup](https://rollupjs.org/). Make sure you also install the polyfills for [`fetch`](https://github.com/matthew-andrews/isomorphic-fetch) and [`Promise`](https://github.com/stefanpenner/es6-promise). You can find `npm install` commands for all packages in the [API reference](../api).

```bash
npm install @esri/arcgis-rest-request isomorphic-fetch es6-promise
```

Import the `isomorphic-fetch` and `es6-promise` polyfills before using ArcGIS REST JS.

```js
import "isomorphic-fetch";
import "es6-promise";

import { request } from "@esri/arcgis-rest-request";

request("https://www.arcgis.com/sharing/rest/info").then(response => {
console.log(response);
});
```

**Note**: many other libraries or tools (such as [Babel](https://babeljs.io/docs/usage/polyfill/)) require an ES6 `Promise` polyfill. Any `Promise` polyfill will work with ArcGIS REST JS, `es6-promise` is simply a lightweight standalone version.
21 changes: 21 additions & 0 deletions docs/src/guides/babel-and-webpack.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,24 @@ group: 1-get-started
---

# Get Started with Babel and Webpack

ArcGIS REST JS is ready-to-use with popular module bundlers like [webpack](https://webpack.js.org/) and [rollup](https://rollupjs.org/). Make sure you also install the polyfills for [`fetch`](https://github.com/matthew-andrews/isomorphic-fetch) and [`Promise`](https://github.com/stefanpenner/es6-promise). You can find `npm install` commands for all packages in the [API reference](../api).

```bash
npm install @esri/arcgis-rest-request isomorphic-fetch es6-promise
```

Import the `isomorphic-fetch` and `es6-promise` polyfills before using ArcGIS REST JS.

```js
import "isomorphic-fetch";
import "es6-promise";

import { request } from "@esri/arcgis-rest-request";

request("https://www.arcgis.com/sharing/rest/info").then(response => {
console.log(response);
});
```

**Note**: many other libraries or tools (such as [Babel](https://babeljs.io/docs/usage/polyfill/)) require an ES6 `Promise` polyfill. Any `Promise` polyfill will work with ArcGIS REST JS, `es6-promise` is simply a lightweight standalone version.
29 changes: 28 additions & 1 deletion docs/src/guides/from-a-cdn.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,31 @@ order: 20
group: 1-get-started
---

# Get Started with ArcGIS REST JS from a CDN
# Get Started using a CDN

ArcGIS REST JS is hosted on [unpkg](https://unpkg.com/). You can find URLs for individual packages in the [API reference](../api).

```html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>ArcGIS REST JS</title>
</head>
<body>
Open your console to see the demo.
</body>
<!-- require polyfills for fetch and Promise from https://polyfill.io -->
<script src="https://cdn.polyfill.io/v2/polyfill.js?features=es5,Promise,fetch"></script>

<!-- require ArcGIS REST JS libraries from https://unpkg.com -->
<script src="{% cdnUrl data.typedoc | findPackage('@esri/arcgis-rest-request') %}"></script>

<script>
// when including ArcGIS REST JS all exports are available from an arcgisRest global
arcgisRest.request("https://www.arcgis.com/sharing/rest/info").then(response => {
console.log(response);
});
</script>
</html>
90 changes: 7 additions & 83 deletions docs/src/guides/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ description: Get started with ArcGIS REST JS.

# Get Started

ArcGIS REST JS can be deployed with variety of build tools, including:
ArcGIS REST JS can be deployed with a variety of build tools, including:

* [From a CDN](./from-a-cdn/) (Coming soon)
* [Babel + WebPack](./babel-and-webpack/) (Coming soon)
* [TypeScript + WebPack](./typescript-and-webpack/) (Coming soon)
* [From a CDN](./from-a-cdn/)
* [Babel + Webpack](./babel-and-webpack/)
* [TypeScript + Webpack](./typescript-and-webpack/) (Coming soon)
* [AMD (Require.js or Dojo)](amd-requirejs-dojo/) (Coming soon)
* [Node.js](./node/) (Coming soon)
* [Babel + Rollup](./babel-and-rollup/) (Coming soon)
* [Node.js](./node/)
* [Babel + Rollup](./babel-and-rollup/)
* [Browserify](./browserify/) (Coming soon)

## Requirements
Expand Down Expand Up @@ -49,80 +49,4 @@ We recommend the ones below:
* [`isomorphic-fetch`](https://www.npmjs.com/package/isomorphic-fetch) - to polyfill `Fetch`
* [`isomorphic-form-data`](https://github.com/form-data/isomorphic-form-data) - to polyfill `FormData`

Other versions of Node.js may also work with appropriate polyfills but we cannot guarantee support.

## Get started from CDN

ArcGIS REST JS is hosted on [unpkg](https://unpkg.com/). You can find URLs for individual packages in the [API reference](../api).

```html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>ArcGIS REST JS</title>
</head>
<body>
Open your console to see the demo.
</body>
<!-- require polyfills for fetch and Promise from https://polyfill.io -->
<script src="https://cdn.polyfill.io/v2/polyfill.js?features=es5,Promise,fetch"></script>

<!-- require ArcGIS REST JS libraries from https://unpkg.com -->
<script src="{% cdnUrl data.typedoc | findPackage('@esri/arcgis-rest-request') %}"></script>

<script>
// when including ArcGIS REST JS all exports are available from an arcgisRest global
arcgisRest.request("https://www.arcgis.com/sharing/rest/info").then(response => {
console.log(response);
});
</script>
</html>
```

## Get started with a bundler (webpack, rollup, ect&hellip;)

ArcGIS REST JS is ready-to-use with popular module bundlers like [webpack](https://webpack.js.org/) and [rollup](https://rollupjs.org/). Make sure you also install the polyfills for [`fetch`](https://github.com/matthew-andrews/isomorphic-fetch) and [`Promise`](https://github.com/stefanpenner/es6-promise). You can find `npm install` commands for all packages in the [API reference](../api).

```bash
npm install @esri/arcgis-rest-request isomorphic-fetch es6-promise
```

Import the `isomorphic-fetch` and `es6-promise` polyfills before using ArcGIS REST JS.

```js
import "isomorphic-fetch";
import "es6-promise";

import { request } from "@esri/arcgis-rest-request";

request("https://www.arcgis.com/sharing/rest/info").then(response => {
console.log(response);
});
```

**Note**: many other libraries or tools (such as [Babel](https://babeljs.io/docs/usage/polyfill/)) require an ES6 `Promise` polyfill. Any `Promise` polyfill will work with ArcGIS REST JS, `es6-promise` is simply a lightweight standalone version.

## Get started with Node.js

Make sure you have polyfills for [`fetch`](https://github.com/matthew-andrews/isomorphic-fetch) and [`FormData`](https://github.com/form-data/isomorphic-form-data) installed before using any ArcGIS REST JS library. You can find `npm install` commands for all packages in the [API reference](../api).

```bash
npm install @esri/arcgis-rest-request isomorphic-fetch isomorphic-form-data
```

Require the `isomorphic-fetch` and `isomorphic-form-data` modules before using any of the ArcGIS REST JS methods.

```js
require("isomorphic-fetch");
require("isomorphic-form-data");

const { request } = require("@esri/arcgis-rest-request");

request("https://www.arcgis.com/sharing/rest/info").then(response => {
console.log(response);
});
```

[Demo express application](https://github.com/Esri/arcgis-rest-js/tree/master/demos/express)
Other versions of Node.js may also work with appropriate polyfills but we cannot guarantee support.
23 changes: 22 additions & 1 deletion docs/src/guides/node.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,25 @@ order: 60
group: 1-get-started
---

# Get Started with ArcGIS REST JS and Node.js
# Get Started with Node.js

Make sure you have polyfills for [`fetch`](https://github.com/matthew-andrews/isomorphic-fetch) and [`FormData`](https://github.com/form-data/isomorphic-form-data) installed before using any ArcGIS REST JS library. You can find `npm install` commands for all packages in the [API reference](../api).

```bash
npm install @esri/arcgis-rest-request isomorphic-fetch isomorphic-form-data
```

Require the `isomorphic-fetch` and `isomorphic-form-data` modules before using any of the ArcGIS REST JS methods.

```js
require("isomorphic-fetch");
require("isomorphic-form-data");

const { request } = require("@esri/arcgis-rest-request");

request("https://www.arcgis.com/sharing/rest/info").then(response => {
console.log(response);
});
```

[Demo express application](https://github.com/Esri/arcgis-rest-js/tree/master/demos/express)

0 comments on commit 3d5b371

Please sign in to comment.