@stacksjs/rpx 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -62,6 +62,40 @@ const config: ReverseProxyOptions = {
62
62
  startProxy(config)
63
63
  ```
64
64
 
65
+ In case you are trying to start multiple proxies, you may use this configuration:
66
+
67
+ ```ts
68
+ // reverse-proxy.config.{ts,js}
69
+ import type { ReverseProxyOptions } from '@stacksjs/rpx'
70
+ import os from 'node:os'
71
+ import path from 'node:path'
72
+
73
+ const config: ReverseProxyOptions = {
74
+ https: { // https: true -> also works with sensible defaults
75
+ caCertPath: path.join(os.homedir(), '.stacks', 'ssl', `stacks.localhost.ca.crt`),
76
+ certPath: path.join(os.homedir(), '.stacks', 'ssl', `stacks.localhost.crt`),
77
+ keyPath: path.join(os.homedir(), '.stacks', 'ssl', `stacks.localhost.crt.key`),
78
+ },
79
+
80
+ etcHostsCleanup: true,
81
+
82
+ proxies: [
83
+ {
84
+ from: 'localhost:5173',
85
+ to: 'my-app.localhost',
86
+ },
87
+ {
88
+ from: 'localhost:5174',
89
+ to: 'my-api.local',
90
+ },
91
+ ],
92
+
93
+ verbose: true,
94
+ }
95
+
96
+ export default config
97
+ ```
98
+
65
99
  ### CLI
66
100
 
67
101
  ```bash
@@ -106,40 +140,6 @@ const config: ReverseProxyOptions = {
106
140
  export default config
107
141
  ```
108
142
 
109
- In case you are trying to start multiple proxies, you may use this configuration:
110
-
111
- ```ts
112
- // reverse-proxy.config.{ts,js}
113
- import type { ReverseProxyOptions } from '@stacksjs/rpx'
114
- import os from 'node:os'
115
- import path from 'node:path'
116
-
117
- const config: ReverseProxyOptions = {
118
- https: { // https: true -> also works with sensible defaults
119
- caCertPath: path.join(os.homedir(), '.stacks', 'ssl', `stacks.localhost.ca.crt`),
120
- certPath: path.join(os.homedir(), '.stacks', 'ssl', `stacks.localhost.crt`),
121
- keyPath: path.join(os.homedir(), '.stacks', 'ssl', `stacks.localhost.crt.key`),
122
- },
123
-
124
- etcHostsCleanup: true,
125
-
126
- proxies: [
127
- {
128
- from: 'localhost:5173',
129
- to: 'my-app.localhost',
130
- },
131
- {
132
- from: 'localhost:5174',
133
- to: 'my-api.local',
134
- },
135
- ],
136
-
137
- verbose: true,
138
- }
139
-
140
- export default config
141
- ```
142
-
143
143
  _Then run:_
144
144
 
145
145
  ```bash