Skip to content

Commit 9568f4d

Browse files
committedOct 11, 2018
update dependencies and sample code
1 parent 88d854c commit 9568f4d

7 files changed

+82
-11
lines changed
 

‎.env.example

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#APP TOKEN
2+
TOKEN_WORKER_NAME=JorgeRosal
3+
TOKEN_PASSWORD=MyPassword123
4+
5+
#LOGIN
6+
LOGIN_URL=<custom URL here>
7+
EMAIL=<your seller central email here>
8+
PASSWORD=<your super awesome password here>
9+
10+
#DATABASE
11+
DB_CLIENT=
12+
DB_HOST=
13+
DB_USER=
14+
DB_PASSWORD=
15+
DB_NAME=

‎README.md

+11-9
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,19 @@ Clean and minimalistic boilerplate to start your NodeJs project.
33

44
### ⭐ Good for
55
- Building a worker scripts.
6-
- Building scripting and automation tool.
7-
- Stand-alone, fully customizable project.
8-
- Creating clean file structured project.
6+
- Stand-alone scripting and automation tool.
7+
- Fully customizable project.
8+
- Clean file structuring.
99
- Following standard naming conventions so collaborators/team8s can understand easily your code.
10+
- Securing your login and api key details by using environment variable -- [dotenv](https://github.com/motdotla/dotenv)
1011

1112
### 📘 Prerequisites
12-
- NodeJs Installed in your local environment.
13+
- NodeJs, git installed in your local environment.
1314
- .env file -- Yes you need this!
1415

1516
### 📝 Usage
1617
1. Clone the repo to your local environment.
17-
- On the command prompt run the following commands:
18+
- In the command prompt run the following commands:
1819
run ```git clone https://github.com/yortrosal/nodejs-boilerplate.git ```
1920
then ```cd nodejs-boilerplate ```
2021
2. run ```npm install``` to install initial dependencies.
@@ -29,10 +30,7 @@ Clean and minimalistic boilerplate to start your NodeJs project.
2930
It has variety of usage. Find out [more](https://codeburst.io/process-env-what-it-is-and-why-when-how-to-use-it-effectively-505d0b2831e7).
3031
But the sole purpose of using .env file for our project is to secure our credentials such as logins, api keys, and other important stuff. It is important not to include your .env file when you in our repository specially when your project is public. It's easy
3132

32-
### Accessing your credentials from .env file.
33-
34-
35-
## 🏗 Project Structure
33+
### 🏗 Project Structure
3634
nodejs-boilerplate
3735
├── core
3836
│ ├── custom-subfolder-example
@@ -45,10 +43,14 @@ But the sole purpose of using .env file for our project is to secure our credent
4543
4644
├── .env.example
4745
├── .env
46+
├── .plans
4847
├── .gitignore
4948
├── package.json
5049
└── README.md
5150

51+
### Initial Dependency
52+
- [ckey](https://www.npmjs.com/package/ckey) - a dotenv helper for accessing process.env object from sub-directory.
53+
5254
### 💬 Tech Support
5355
- If things went wrong, google it first. People ahead of you have had similar issues in the past and solved it.
5456
- Last resort. -- Contact Jorge. He'd be happy to help you.

‎app.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// this example calls a function inside your core folder and console.log the result which is "Hello World."
2+
3+
const iDisplayHelloWorld = require('./core/hello-world'); //this will pull out the object of whatever you exported from hello-world.js file.
4+
5+
console.log(iDisplayHelloWorld());

‎core/hello-world.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// function that returns "hello world" when called.
2-
const iDisplayHelloWorld = () => return "Hello World";
2+
const iDisplayHelloWorld = () => {return 'Hello World!';}
33

44
// export iDisplayHelloWorld function.
55
module.exports = iDisplayHelloWorld;

‎core/sample-script.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// example code for accessing your credentils from .env file.
2+
const ck = require('ckey');
3+
4+
const loginUrl = ck.LOGIN_URL;
5+
const email = ck.EMAIL;
6+
const password = ck.PASSWORD;

‎package-lock.json

+43
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414
"author": "Jorge Rosal",
1515
"license": "MIT",
1616
"dependencies": {
17-
"dotenv": "^6.1.0"
17+
"ckey": "^1.0.2"
1818
}
1919
}

0 commit comments

Comments
 (0)
Please sign in to comment.