|
1 | 1 | <p align="center"> |
2 | | - <a |
3 | | - href="https://assurance-maladie-digital.github.io/vue-cli-plugin-proxy/" |
4 | | - target="_blank" |
5 | | - rel="noopener noreferrer" |
6 | | - > |
7 | | - <img |
8 | | - width="280" |
9 | | - src="https://unpkg.com/@cnamts/vue-cli-plugin-proxy@2.1.2/docs/img/vue.js.svg" |
10 | | - alt="VueDot" |
11 | | - > |
12 | | - </a> |
| 2 | + <img |
| 3 | + width="280" |
| 4 | + src="https://user-images.githubusercontent.com/10298932/59419196-af91f800-8dca-11e9-9ea8-de5567e9e471.png" |
| 5 | + alt="" |
| 6 | + > |
13 | 7 | </p> |
14 | 8 |
|
15 | | -<h1 align="center">CNAM – Vue CLI plugin proxy</h1> |
| 9 | +<h1 align="center">Vue CLI proxy plugin</h1> |
16 | 10 |
|
17 | 11 | <p align="center">This plugin is meant to provide all <a href="https://www.npmjs.com/package/http-proxy-middleware">http-proxy-middleware</a> options to vue-cli.</p> |
18 | 12 |
|
19 | 13 | <p align="center"> |
20 | | - <a href="https://www.npmjs.com/package/@cnamts/vue-cli-plugin-proxy"> |
21 | | - <img |
22 | | - src="https://img.shields.io/npm/v/@cnamts/vue-cli-plugin-proxy.svg?style=flat-square" |
23 | | - alt="NPM Version" |
24 | | - > |
25 | | - </a> |
26 | | - <a href="https://www.npmjs.com/package/@cnamts/vue-cli-plugin-proxy"> |
27 | | - <img |
28 | | - src="https://img.shields.io/npm/dw/@cnamts/vue-cli-plugin-proxy.svg?style=flat-square" |
29 | | - alt="NPM Downloads" |
30 | | - > |
31 | | - </a> |
32 | | - <a |
33 | | - href="https://github.com/assurance-maladie-digital/vue-cli-plugin-proxy/blob/master/LICENSE"> |
34 | | - <img |
35 | | - src="https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square" |
36 | | - alt="License" |
37 | | - > |
38 | | - </a> |
| 14 | + <a href="https://www.npmjs.com/package/vue-cli-proxy-plugin"> |
| 15 | + <img |
| 16 | + src="https://img.shields.io/npm/v/vue-cli-proxy-plugin.svg?style=flat-square" |
| 17 | + alt="NPM Version" |
| 18 | + > |
| 19 | + </a> |
| 20 | + <a href="https://www.npmjs.com/package/vue-cli-proxy-plugin"> |
| 21 | + <img |
| 22 | + src="https://img.shields.io/npm/dw/vue-cli-proxy-plugin.svg?style=flat-square" |
| 23 | + alt="NPM Downloads" |
| 24 | + > |
| 25 | + </a> |
| 26 | + <a |
| 27 | + href="https://github.com/assurance-maladie-digital/vue-cli-plugin-proxy/blob/master/LICENSE"> |
| 28 | + <img |
| 29 | + src="https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square" |
| 30 | + alt="License" |
| 31 | + > |
| 32 | + </a> |
39 | 33 | </p> |
40 | 34 |
|
41 | 35 | ## Issue |
42 | 36 |
|
43 | 37 | See [the issue than initiated this plugin (#2320)](https://github.com/vuejs/vue-cli/issues/2320) |
44 | 38 |
|
45 | | -## As Easy as 1, 2, 3 |
46 | | - |
47 | | -### Install |
| 39 | +## Installation |
48 | 40 |
|
49 | 41 | ``` bash |
50 | | -yarn add @cnamts/vue-cli-plugin-proxy # OR npm install @cnamts/vue-cli-plugin-proxy |
| 42 | +yarn add vue-cli-proxy-plugin |
| 43 | +# OR npm install vue-cli-proxy-plugin |
51 | 44 | ``` |
52 | 45 |
|
53 | | -### Use |
| 46 | +## Usage |
54 | 47 |
|
55 | | -``` js |
| 48 | +```js |
56 | 49 | // vue.config.js |
57 | 50 | module.exports = { |
58 | | - pluginOptions: { |
59 | | - proxy: { |
60 | | - enabled: true, |
61 | | - context: '', |
62 | | - options: { |
63 | | - // ... |
64 | | - } |
65 | | - } |
66 | | - } |
| 51 | + pluginOptions: { |
| 52 | + proxy: { |
| 53 | + enabled: true, |
| 54 | + context: '', |
| 55 | + options: { |
| 56 | + // ... |
| 57 | + } |
| 58 | + } |
| 59 | + } |
67 | 60 | } |
68 | 61 | ``` |
69 | 62 |
|
70 | | -### You're done! 🎉 |
| 63 | +## Options |
71 | 64 |
|
72 | 65 | See [http-proxy-middleware](https://www.npmjs.com/package/http-proxy-middleware#tldr) for `options` object to pass to the plugin. |
73 | 66 |
|
74 | | -#### Object examples |
| 67 | +### Object examples |
75 | 68 |
|
76 | 69 | * First example of the docs: |
77 | 70 |
|
78 | | -``` js |
| 71 | +```js |
79 | 72 | // vue.config.js |
80 | 73 | module.exports = { |
81 | | - pluginOptions: { |
82 | | - proxy: { |
83 | | - enabled: true, |
84 | | - context: '/api', |
85 | | - options: { |
86 | | - target: 'http://www.example.org', |
87 | | - changeOrigin: true |
88 | | - } |
89 | | - } |
90 | | - } |
| 74 | + pluginOptions: { |
| 75 | + proxy: { |
| 76 | + enabled: true, |
| 77 | + context: '/api', |
| 78 | + options: { |
| 79 | + target: 'http://www.example.org', |
| 80 | + changeOrigin: true |
| 81 | + } |
| 82 | + } |
| 83 | + } |
91 | 84 | } |
92 | 85 | ``` |
93 | 86 |
|
94 | 87 | * v1.0.0 default: |
95 | 88 |
|
96 | | -``` js |
| 89 | +```js |
97 | 90 | // vue.config.js |
98 | 91 | module.exports = { |
99 | | - pluginOptions: { |
100 | | - proxy: { |
101 | | - enabled: true, |
102 | | - context: ['/**', '!/dist/**'], |
103 | | - options: { |
104 | | - target: 'http://127.0.0.1:8000', |
105 | | - } |
106 | | - } |
107 | | - } |
| 92 | + pluginOptions: { |
| 93 | + proxy: { |
| 94 | + enabled: true, |
| 95 | + context: [ |
| 96 | + '/**', |
| 97 | + '!/dist/**' |
| 98 | + ], |
| 99 | + options: { |
| 100 | + target: 'http://127.0.0.1:8000' |
| 101 | + } |
| 102 | + } |
| 103 | + } |
108 | 104 | } |
109 | 105 | ``` |
110 | 106 |
|
|
0 commit comments