Skip to content

Commit

Permalink
standardize the code between multiple nodejs repos
Browse files Browse the repository at this point in the history
  • Loading branch information
rajeshg-vcloudx committed Nov 18, 2020
1 parent 8514535 commit c787ffb
Show file tree
Hide file tree
Showing 9 changed files with 136 additions and 306 deletions.
44 changes: 20 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,30 +53,26 @@ The following can also be used to create a self-signed certificate.

#### 3.1.3 Configure

Before you can run this application, configure the service by editing `server/vcxconfig.js` file to meet project requirement:
```javascript
vcxconfig.SERVICE = {
name: "EnableX Sample Web App", // Name of the Application [Change optional]
version: "1.0.0", // Version [Change optional]
path: "/v1", // Route [Default /v1]
domain: "yourdomain.com", // FQDN of your hosting enviornment
port : "4443", // FQDN of your hosting port. You need sudo permission if you want to use standard 443
listen_ssl : true // SSL on/off key [ Set always to "true" ]
};

vcxconfig.Certificate = {
ssl_key: "certs/example.key", // Use the certificate ".key" [self signed or registered]
ssl_cert : "certs/example.crt", // Use the certificate ".crt" [self signed or registered]
sslCaCerts : '' // Use the certificate CA[chain] [self signed or registered]
};

vcxconfig.SERVER_API_SERVER = {
host: 'api.enablex.io', // Hosted EnableX Server API Domain Name
};

vcxconfig.clientPath = "../client"; // UI files location
vcxconfig.APP_ID = "YOUR_APP_ID"; // Enter Your App ID
vcxconfig.APP_KEY = "YOUR_APP_KEY"; // Enter Your App Key
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:

```javascript
SERVICE_PORT - Node port on which your application will run. Default port set is 5000
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/
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/
```

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:
```javascript
export SERVICE_PORT=XXXX
export ENABLEX_APP_ID=XXXXXXXXXX
export ENABLEX_APP_KEY=XXXXXXXXX
```

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:
```javascript
setx SERVICE_PORT 'XXXX'
setx ENABLEX_APP_ID 'XXXXXXXXX'
setx ENABLEX_APP_KEY 'XXXXXXXXX'
```

### 3.2 Build
Expand Down
121 changes: 31 additions & 90 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@
"license": "ISC",
"dependencies": {
"body-parser": "^1.19.0",
"btoa": "^1.1.2",
"debug": "^4.2.0",
"express": "^4.16.2",
"log4js": "^4.5.1",
"morgan": "^1.9.0"
"btoa": "^1.2.1",
"dotenv": "^8.2.0",
"express": "^4.17.1",
"log4js": "^6.3.0"
}
}
16 changes: 16 additions & 0 deletions server/example.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Port No. of this Service
SERVICE_PORT=3000

# SSL Certificate (Self Signed or Registered)
# Path to .key file
CERTIFICATE_SSL_KEY=certs/example.key
# Path to .crt file
CERTIFICATE_SSL_CERT=certs/example.crt
# Path to CA[chain]
CERTIFICATE_SSLCACERTS=

# APP ID to access Server API
ENABLEX_APP_ID=

# APP KEY to access Server API
ENABLEX_APP_KEY=
Loading

0 comments on commit c787ffb

Please sign in to comment.