Skip to content

Commit d8bae71

Browse files
committed
update JS petstore samples
1 parent d20537b commit d8bae71

File tree

2 files changed

+52
-2
lines changed

2 files changed

+52
-2
lines changed

samples/client/petstore/javascript-promise/README.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,30 @@ Then install it via:
2323
npm install swagger_petstore --save
2424
```
2525

26+
##### Local development
27+
28+
To use the library locally without publishing to a remote npm registry, first install the dependencies by changing
29+
into the directory containing `package.json` (and this README). Let's call this `JAVASCRIPT_CLIENT_DIR`. Then run:
30+
31+
```shell
32+
npm install
33+
```
34+
35+
Next, [link](https://docs.npmjs.com/cli/link) it globally in npm with the following, also from `JAVASCRIPT_CLIENT_DIR`:
36+
37+
```shell
38+
npm link
39+
```
40+
41+
Finally, switch to the directory you want to use your swagger_petstore from, and run:
42+
43+
```shell
44+
npm link /path/to/<JAVASCRIPT_CLIENT_DIR>
45+
```
46+
47+
You should now be able to `require('swagger_petstore')` in javascript files from the directory you ran the last
48+
command above from.
49+
2650
#### git
2751
#
2852
If the library is hosted at a git repository, e.g.
@@ -37,7 +61,8 @@ then install it via:
3761

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

4267
```shell
4368
browserify main.js > bundle.js

samples/client/petstore/javascript/README.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,30 @@ Then install it via:
2323
npm install swagger_petstore --save
2424
```
2525

26+
##### Local development
27+
28+
To use the library locally without publishing to a remote npm registry, first install the dependencies by changing
29+
into the directory containing `package.json` (and this README). Let's call this `JAVASCRIPT_CLIENT_DIR`. Then run:
30+
31+
```shell
32+
npm install
33+
```
34+
35+
Next, [link](https://docs.npmjs.com/cli/link) it globally in npm with the following, also from `JAVASCRIPT_CLIENT_DIR`:
36+
37+
```shell
38+
npm link
39+
```
40+
41+
Finally, switch to the directory you want to use your swagger_petstore from, and run:
42+
43+
```shell
44+
npm link /path/to/<JAVASCRIPT_CLIENT_DIR>
45+
```
46+
47+
You should now be able to `require('swagger_petstore')` in javascript files from the directory you ran the last
48+
command above from.
49+
2650
#### git
2751
#
2852
If the library is hosted at a git repository, e.g.
@@ -37,7 +61,8 @@ then install it via:
3761

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

4267
```shell
4368
browserify main.js > bundle.js

0 commit comments

Comments
 (0)