Skip to content

Commit

Permalink
update JS petstore samples
Browse files Browse the repository at this point in the history
  • Loading branch information
wing328 committed Jul 13, 2017
1 parent d20537b commit d8bae71
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 2 deletions.
27 changes: 26 additions & 1 deletion samples/client/petstore/javascript-promise/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,30 @@ Then install it via:
npm install swagger_petstore --save
```

##### Local development

To use the library locally without publishing to a remote npm registry, first install the dependencies by changing
into the directory containing `package.json` (and this README). Let's call this `JAVASCRIPT_CLIENT_DIR`. Then run:

```shell
npm install
```

Next, [link](https://docs.npmjs.com/cli/link) it globally in npm with the following, also from `JAVASCRIPT_CLIENT_DIR`:

```shell
npm link
```

Finally, switch to the directory you want to use your swagger_petstore from, and run:

```shell
npm link /path/to/<JAVASCRIPT_CLIENT_DIR>
```

You should now be able to `require('swagger_petstore')` in javascript files from the directory you ran the last
command above from.

#### git
#
If the library is hosted at a git repository, e.g.
Expand All @@ -37,7 +61,8 @@ then install it via:

The library also works in the browser environment via npm and [browserify](https://browserify.org/). After following
the above steps with Node.js and installing browserify with `npm install -g browserify`,
perform the following (assuming *main.js* is your entry file):
perform the following (assuming *main.js* is your entry file, that's to say your javascript file where you actually
use this library):

```shell
browserify main.js > bundle.js
Expand Down
27 changes: 26 additions & 1 deletion samples/client/petstore/javascript/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,30 @@ Then install it via:
npm install swagger_petstore --save
```

##### Local development

To use the library locally without publishing to a remote npm registry, first install the dependencies by changing
into the directory containing `package.json` (and this README). Let's call this `JAVASCRIPT_CLIENT_DIR`. Then run:

```shell
npm install
```

Next, [link](https://docs.npmjs.com/cli/link) it globally in npm with the following, also from `JAVASCRIPT_CLIENT_DIR`:

```shell
npm link
```

Finally, switch to the directory you want to use your swagger_petstore from, and run:

```shell
npm link /path/to/<JAVASCRIPT_CLIENT_DIR>
```

You should now be able to `require('swagger_petstore')` in javascript files from the directory you ran the last
command above from.

#### git
#
If the library is hosted at a git repository, e.g.
Expand All @@ -37,7 +61,8 @@ then install it via:

The library also works in the browser environment via npm and [browserify](https://browserify.org/). After following
the above steps with Node.js and installing browserify with `npm install -g browserify`,
perform the following (assuming *main.js* is your entry file):
perform the following (assuming *main.js* is your entry file, that's to say your javascript file where you actually
use this library):

```shell
browserify main.js > bundle.js
Expand Down

0 comments on commit d8bae71

Please sign in to comment.