@maxpeterkaya/web-proxy 1.0.1 → 1.0.3
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/INSTALL-GUIDE.md +38 -3
- package/README.md +2 -0
- package/{install.js → bin/install.js} +2 -2
- package/package.json +3 -2
package/INSTALL-GUIDE.md
CHANGED
|
@@ -1,8 +1,43 @@
|
|
|
1
1
|
# How to install web-proxy
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## NPM Package
|
|
4
|
+
|
|
5
|
+
You can install web-proxy as a wrapper in the form of a npm package! This allows you to dynamically download the latest
|
|
6
|
+
version of web-proxy at all times in your build stage without having to tweak your process to manually fetch the latest
|
|
7
|
+
version through commands.
|
|
4
8
|
|
|
5
9
|
### Step 1
|
|
6
|
-
In your Dockerfile
|
|
7
10
|
|
|
8
|
-
|
|
11
|
+
Install: ``npm i @maxpeterkaya/web-proxy concurrently``
|
|
12
|
+
|
|
13
|
+
While running ``npm i``, it will automatically download the latest binary with execution permissions.
|
|
14
|
+
|
|
15
|
+
Currently you need to run your app and web-proxy through concurrently to ensure both are running concurrently.
|
|
16
|
+
|
|
17
|
+
### Step 2
|
|
18
|
+
|
|
19
|
+
Add the following scripts to your package.json:
|
|
20
|
+
|
|
21
|
+
```json
|
|
22
|
+
{
|
|
23
|
+
"scripts": {
|
|
24
|
+
"start:proxy": "./node_modules/.bin/web-proxy",
|
|
25
|
+
"start:web": "YOUR COMMAND TO START YOUR APP",
|
|
26
|
+
"start": "concurrently --prefix none \"npm run start:web\" \"npm run start:proxy\""
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
You can view the docs for concurrently [here](https://github.com/open-cli-tools/concurrently/tree/main/docs).
|
|
32
|
+
|
|
33
|
+
#
|
|
34
|
+
|
|
35
|
+
In the future web-proxy will be able to start your web app itself without the use of concurrently.
|
|
36
|
+
|
|
37
|
+
### Step 3
|
|
38
|
+
|
|
39
|
+
Simply just run ``npm run start`` and enjoy structured logs.
|
|
40
|
+
|
|
41
|
+
## Container Middleware
|
|
42
|
+
|
|
43
|
+
Follow the steps [here](https://github.com/maxpeterkaya/web-proxy/tree/main/examples/container-middleware).
|
package/README.md
CHANGED
|
@@ -12,6 +12,8 @@ Some of these frameworks may include:
|
|
|
12
12
|
- NextJS
|
|
13
13
|
- PrismaORM
|
|
14
14
|
|
|
15
|
+
## [Installation Guide](https://github.com/maxpeterkaya/web-proxy/blob/main/INSTALL-GUIDE.md)
|
|
16
|
+
|
|
15
17
|
## Examples
|
|
16
18
|
|
|
17
19
|
- [Container middleware](https://github.com/maxpeterkaya/web-proxy/tree/main/examples/container-middleware)
|
|
@@ -25,7 +25,7 @@ if (!assetName) {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
const url = `https://github.com/maxpeterkaya/web-proxy/releases/latest/download/web-proxy_${assetName}`;
|
|
28
|
-
const destDir = path.join(__dirname
|
|
28
|
+
const destDir = path.join(__dirname);
|
|
29
29
|
const destFile = path.join(destDir, `${platform === "win32" ? "web-proxy.exe" : "web-proxy"}`);
|
|
30
30
|
|
|
31
31
|
(async () => {
|
|
@@ -35,7 +35,7 @@ const destFile = path.join(destDir, `${platform === "win32" ? "web-proxy.exe" :
|
|
|
35
35
|
const res = await fetch(url);
|
|
36
36
|
if (!res.ok) throw new Error(`Failed to fetch ${url}: ${res.statusText}`);
|
|
37
37
|
|
|
38
|
-
const fileStream = fs.createWriteStream(destFile);
|
|
38
|
+
const fileStream = fs.createWriteStream(destFile, {mode: 0o755});
|
|
39
39
|
await finished(Readable.fromWeb(res.body).pipe(fileStream));
|
|
40
40
|
|
|
41
41
|
console.info('web-proxy installed.');
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maxpeterkaya/web-proxy",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Server middleware enabling better logging for web apps through structured logs",
|
|
5
5
|
"bin": {
|
|
6
6
|
"web-proxy": "bin/run.js"
|
|
7
7
|
},
|
|
8
8
|
"scripts": {
|
|
9
|
-
"postinstall": "node install.js"
|
|
9
|
+
"postinstall": "node bin/install.js",
|
|
10
|
+
"start": "npx web-proxy"
|
|
10
11
|
},
|
|
11
12
|
"repository": {
|
|
12
13
|
"type": "git",
|