Skip to content

Commit c787ffb

Browse files
standardize the code between multiple nodejs repos
1 parent 8514535 commit c787ffb

File tree

9 files changed

+136
-306
lines changed

9 files changed

+136
-306
lines changed

README.md

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -53,30 +53,26 @@ The following can also be used to create a self-signed certificate.
5353

5454
#### 3.1.3 Configure
5555

56-
Before you can run this application, configure the service by editing `server/vcxconfig.js` file to meet project requirement:
57-
```javascript
58-
vcxconfig.SERVICE = {
59-
name: "EnableX Sample Web App", // Name of the Application [Change optional]
60-
version: "1.0.0", // Version [Change optional]
61-
path: "/v1", // Route [Default /v1]
62-
domain: "yourdomain.com", // FQDN of your hosting enviornment
63-
port : "4443", // FQDN of your hosting port. You need sudo permission if you want to use standard 443
64-
listen_ssl : true // SSL on/off key [ Set always to "true" ]
65-
};
66-
67-
vcxconfig.Certificate = {
68-
ssl_key: "certs/example.key", // Use the certificate ".key" [self signed or registered]
69-
ssl_cert : "certs/example.crt", // Use the certificate ".crt" [self signed or registered]
70-
sslCaCerts : '' // Use the certificate CA[chain] [self signed or registered]
71-
};
72-
73-
vcxconfig.SERVER_API_SERVER = {
74-
host: 'api.enablex.io', // Hosted EnableX Server API Domain Name
75-
};
76-
77-
vcxconfig.clientPath = "../client"; // UI files location
78-
vcxconfig.APP_ID = "YOUR_APP_ID"; // Enter Your App ID
79-
vcxconfig.APP_KEY = "YOUR_APP_KEY"; // Enter Your App Key
56+
Before you can run this application, configure the service. Copy the `server/example.env` as `server/.env` and update the values. Or you can set following system environment variables instead:
57+
58+
```javascript
59+
SERVICE_PORT - Node port on which your application will run. Default port set is 5000
60+
ENABLEX_APP_ID - Your EnableX `App ID` - It's your username for EnableX API and can be found at Dashboard > Projects https://portal.enablex.io/dashboard/
61+
ENABLEX_APP_KEY - Your EnableX `App Key` - - It's your password for EnableX API and can be found at Dashboard > Projects https://portal.enablex.io/dashboard/
62+
```
63+
64+
For Mac and Linux, open a terminal window and type the following commands. Note - Replace all the characters after the `=` with values from your EnableX account:
65+
```javascript
66+
export SERVICE_PORT=XXXX
67+
export ENABLEX_APP_ID=XXXXXXXXXX
68+
export ENABLEX_APP_KEY=XXXXXXXXX
69+
```
70+
71+
On Windows, open a powershell / command window and type the following commands. Note that there is no `=`, just the key and value separated by a space:
72+
```javascript
73+
setx SERVICE_PORT 'XXXX'
74+
setx ENABLEX_APP_ID 'XXXXXXXXX'
75+
setx ENABLEX_APP_KEY 'XXXXXXXXX'
8076
```
8177

8278
### 3.2 Build

package-lock.json

Lines changed: 31 additions & 90 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,9 @@
1515
"license": "ISC",
1616
"dependencies": {
1717
"body-parser": "^1.19.0",
18-
"btoa": "^1.1.2",
19-
"debug": "^4.2.0",
20-
"express": "^4.16.2",
21-
"log4js": "^4.5.1",
22-
"morgan": "^1.9.0"
18+
"btoa": "^1.2.1",
19+
"dotenv": "^8.2.0",
20+
"express": "^4.17.1",
21+
"log4js": "^6.3.0"
2322
}
2423
}

server/example.env

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Port No. of this Service
2+
SERVICE_PORT=3000
3+
4+
# SSL Certificate (Self Signed or Registered)
5+
# Path to .key file
6+
CERTIFICATE_SSL_KEY=certs/example.key
7+
# Path to .crt file
8+
CERTIFICATE_SSL_CERT=certs/example.crt
9+
# Path to CA[chain]
10+
CERTIFICATE_SSLCACERTS=
11+
12+
# APP ID to access Server API
13+
ENABLEX_APP_ID=
14+
15+
# APP KEY to access Server API
16+
ENABLEX_APP_KEY=

0 commit comments

Comments
 (0)