@cloud-cli/px 1.0.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.
Files changed (3) hide show
  1. package/.prettierrc +9 -0
  2. package/README.md +75 -0
  3. package/package.json +38 -0
package/.prettierrc ADDED
@@ -0,0 +1,9 @@
1
+ {
2
+ "printWidth": 120,
3
+ "tabWidth": 2,
4
+ "useTabs": false,
5
+ "semi": true,
6
+ "singleQuote": true,
7
+ "trailingComma": "all",
8
+ "bracketSpacing": true
9
+ }
package/README.md ADDED
@@ -0,0 +1,75 @@
1
+ ## PX
2
+
3
+ Reverse proxy with Nginx
4
+
5
+ #### Usage
6
+
7
+ As a module:
8
+
9
+ ```ts
10
+ import px from '@cloud-cli/px';
11
+
12
+ px.start({ port: 4567 });
13
+
14
+ px.removeProxy({ domain: 'example.com' });
15
+ px.addProxy({ domain: 'example.com', target: 'localhost:1234' });
16
+
17
+ px.removeCertificate({ domain: 'example.com' });
18
+ px.addCertificate({ domain: 'example.com', certificate: '...', key: '...' });
19
+
20
+ console.log(px.getDomainList());
21
+ console.log(px.getProxyForDomain('example.com'));
22
+ ```
23
+
24
+ With Cloudy CLI:
25
+
26
+ ```ts
27
+ import px from '@cloud-cli/px';
28
+ import { cli } from '@cloud-cli/cy';
29
+
30
+ cli.add('px', px);
31
+ ```
32
+
33
+ **start() options**
34
+
35
+ | Property | Type | Default |
36
+ | -------- | ------ | ----------- |
37
+ | `host` | String | '127.0.0.1' |
38
+ | `port` | Number | |
39
+
40
+ #### HTTP API
41
+
42
+ **Add a certificate**
43
+
44
+ ```
45
+ POST /certificates
46
+
47
+ {
48
+ "domain": "example.com",
49
+ "certificate": "...",
50
+ "key": "...",
51
+ }
52
+
53
+ ```
54
+
55
+ **Add a certificate**
56
+
57
+ ```
58
+ DELETE /certificates/example.com
59
+ ```
60
+
61
+ **Add a service**
62
+
63
+ ```
64
+ POST /services
65
+ {
66
+ "domain": "example.com",
67
+ "target": "localhost:1234"
68
+ }
69
+ ```
70
+
71
+ **Remove a service**
72
+
73
+ ```
74
+ DELETE /services/example.com
75
+ ```
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "@cloud-cli/px",
3
+ "version": "1.0.0",
4
+ "description": "Reverse Proxy API/module",
5
+ "main": "dist/index.js",
6
+ "type": "module",
7
+ "types": "./dist/index.d.ts",
8
+ "scripts": {
9
+ "test": "jest",
10
+ "tdd": "jest --watchAll",
11
+ "build": "rm -rf ./dist/* && tsc --project ./tsconfig.json",
12
+ "start": "node dist/index.js"
13
+ },
14
+ "keywords": [
15
+ "cloudy"
16
+ ],
17
+ "license": "MIT",
18
+ "devDependencies": {
19
+ "@types/jest": "^27.0.1",
20
+ "@types/node": "^14.14.31",
21
+ "jest": "^27.1.0",
22
+ "ts-jest": "^27.0.5",
23
+ "ts-jest-resolver": "^1.1.0",
24
+ "ts-node": "^9.1.1",
25
+ "typescript": "^4.1.3"
26
+ },
27
+ "repository": {
28
+ "type": "git",
29
+ "url": "https://github.com/cloud-cli/px.git"
30
+ },
31
+ "publishConfig": {
32
+ "access": "public"
33
+ },
34
+ "dependencies": {
35
+ "@cloud-cli/gw": "^1.1.2",
36
+ "redbird": "^0.10.0"
37
+ }
38
+ }