@misterzik/espressojs 3.1.14 → 3.1.16
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/.env +4 -3
- package/README.md +12 -5
- package/config.json +8 -1
- package/{Espresso-Logo.png → espresso.png} +0 -0
- package/{espresso-logo.svg → espresso.svg} +0 -0
- package/index.js +7 -4
- package/package.json +2 -2
- package/routes/api/index.js +7 -6
- package/routes/db/index.js +8 -7
- package/routes/index.js +7 -10
- package/server/config/config.development.js +36 -31
- package/server/config/config.global.js +35 -32
- package/server/config/config.production.js +35 -32
- package/server/controllers/client/client.controller.js +8 -6
- package/server/index.js +7 -9
- package/server/models/client.model.js +6 -5
- package/server/utils/espresso-cli.js +6 -5
- package/server/utils/global.message.js +6 -5
package/.env
CHANGED
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-

|
|
2
2
|
|
|
3
3
|
## EspressoJS / Espresso
|
|
4
4
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
## Getting Started
|
|
8
8
|
|
|
9
|
-
- Download [latest release](https://github.com/misterzik/Espresso.js/
|
|
9
|
+
- Download [latest release](https://github.com/misterzik/Espresso.js/releases)
|
|
10
10
|
|
|
11
11
|
`npm install --save @misterzik/espressojs`
|
|
12
12
|
|
|
@@ -14,8 +14,11 @@
|
|
|
14
14
|
|
|
15
15
|
```
|
|
16
16
|
{
|
|
17
|
-
"instance":"
|
|
18
|
-
"
|
|
17
|
+
"instance": "production",
|
|
18
|
+
"hostname": "domain.com",
|
|
19
|
+
"port": 8080,
|
|
20
|
+
"mongoDB": false,
|
|
21
|
+
"swapi": false
|
|
19
22
|
}
|
|
20
23
|
```
|
|
21
24
|
|
|
@@ -26,7 +29,9 @@
|
|
|
26
29
|
MONGO_URI_PORT=27017
|
|
27
30
|
MONGO_URI_DB=clients
|
|
28
31
|
API_URI_ON=FALSE
|
|
29
|
-
API_URI=
|
|
32
|
+
API_URI=""
|
|
33
|
+
API_METHOD="GET"
|
|
34
|
+
API_OBJ_URL=""
|
|
30
35
|
PORT=8080
|
|
31
36
|
```
|
|
32
37
|
|
|
@@ -62,5 +67,7 @@
|
|
|
62
67
|
|
|
63
68
|
### Requirements
|
|
64
69
|
|
|
70
|
+
Installed prior using Espresso.JS
|
|
71
|
+
|
|
65
72
|
- NodeJS
|
|
66
73
|
- NPM
|
package/config.json
CHANGED
|
File without changes
|
|
File without changes
|
package/index.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
1
|
+
/*
|
|
2
|
+
* _| _| _| _| _|_|_|
|
|
3
|
+
* _| _| _|_| _|_| _| _|
|
|
4
|
+
* _| _| _| _| _| _| _|
|
|
5
|
+
* _| _| _| _| _| _|
|
|
6
|
+
* _| _| _| _|_|_|
|
|
7
|
+
* EspressoJS - EspressoJS / Espresso
|
|
5
8
|
* Express Plug & Play Server
|
|
6
9
|
* -----------------
|
|
7
10
|
* @param {*} app - EspressoJS by Vimedev.com Labs
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@misterzik/espressojs",
|
|
3
|
-
"version": "3.1.
|
|
4
|
-
"description": "EspressoJS / Espresso
|
|
3
|
+
"version": "3.1.16",
|
|
4
|
+
"description": "EspressoJS / Espresso is your one-stop Express Configuration starting point or boilerplate. Simple, and unopinionated, EspressoJS plug-and-play configurations are based on Express. Espresso will get you started with an Express instance in seconds.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "echo \"Error: no test specified\"",
|
package/routes/api/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
1
|
+
/*
|
|
2
|
+
* _| _| _| _| _|_|_|
|
|
3
|
+
* _| _| _|_| _|_| _| _|
|
|
4
|
+
* _| _| _| _| _| _| _|
|
|
5
|
+
* _| _| _| _| _| _|
|
|
6
|
+
* _| _| _| _|_|_|
|
|
7
|
+
* EspressoJS - API Routers
|
|
7
8
|
*/
|
|
8
9
|
|
|
9
10
|
const express = require("express");
|
package/routes/db/index.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
1
|
+
/*
|
|
2
|
+
* _| _| _| _| _|_|_|
|
|
3
|
+
* _| _| _|_| _|_| _| _|
|
|
4
|
+
* _| _| _| _| _| _| _|
|
|
5
|
+
* _| _| _| _| _| _|
|
|
6
|
+
* _| _| _| _|_|_|
|
|
7
|
+
* EspressoJS - Client Model
|
|
8
|
+
* --
|
|
7
9
|
* Basic Clients Collection - API CRUD
|
|
8
|
-
* ---
|
|
9
10
|
* @param {*} app - Vimedev.com Labs
|
|
10
11
|
*/
|
|
11
12
|
|
package/routes/index.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
1
|
+
/*
|
|
2
|
+
* _| _| _| _| _|_|_|
|
|
3
|
+
* _| _| _|_| _|_| _| _|
|
|
4
|
+
* _| _| _| _| _| _| _|
|
|
5
|
+
* _| _| _| _| _| _|
|
|
6
|
+
* _| _| _| _|_|_|
|
|
7
|
+
* EspressoJS - Routes Control
|
|
6
8
|
* ----
|
|
7
9
|
* @param {*} app - Vimedev.com Labs
|
|
8
10
|
*/
|
|
@@ -11,18 +13,13 @@ module.exports = (app) => {
|
|
|
11
13
|
const configuration = require("../server"),
|
|
12
14
|
Path = require("path"),
|
|
13
15
|
api = require("./api");
|
|
14
|
-
|
|
15
16
|
app.get("/", function (res) {
|
|
16
17
|
res.sendFile("index.html", { root: Path.join("./public") });
|
|
17
18
|
});
|
|
18
|
-
|
|
19
19
|
if (configuration.swapi_isEnabled == true) {
|
|
20
20
|
app.use("/api", api);
|
|
21
21
|
}
|
|
22
|
-
|
|
23
22
|
require("./db")(app);
|
|
24
|
-
require("../server/utils/global.message")(app);
|
|
25
|
-
|
|
26
23
|
app.use(function (req, res, next) {
|
|
27
24
|
res.status(404).send("404 - Sorry can't find that!");
|
|
28
25
|
});
|
|
@@ -1,35 +1,40 @@
|
|
|
1
1
|
/*
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* _| _| _| _| _|_|_|
|
|
3
|
+
* _| _| _|_| _|_| _| _|
|
|
4
|
+
* _| _| _| _| _| _| _|
|
|
5
|
+
* _| _| _| _| _| _|
|
|
6
|
+
* _| _| _| _|_|_|
|
|
7
|
+
* EspressoJS - EspressoJS / Espresso
|
|
8
|
+
* Dev Template
|
|
6
9
|
*/
|
|
10
|
+
require("dotenv").config();
|
|
11
|
+
const fs = require("fs");
|
|
12
|
+
const configBuffer = fs.readFileSync("./config.json"),
|
|
13
|
+
data = JSON.parse(configBuffer.toString());
|
|
7
14
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
url: "",
|
|
32
|
-
headers: {
|
|
33
|
-
"Content-Type": "application/json",
|
|
34
|
-
},
|
|
15
|
+
const config = () => {
|
|
16
|
+
return {
|
|
17
|
+
env: data.instance || "development",
|
|
18
|
+
hostname: data.hostname || "dev.example.com",
|
|
19
|
+
port: data.instance || "8080",
|
|
20
|
+
mongo_isEnabled: data.mongoDB || true,
|
|
21
|
+
mongo: {
|
|
22
|
+
uri: process.env.MONGO_URI || "localhost",
|
|
23
|
+
port: process.env.MONGO_URI_PORT || "27017",
|
|
24
|
+
db: process.env.MONGO_URI_DB || "myFirstDatabase",
|
|
25
|
+
},
|
|
26
|
+
swapi_isEnabled: data.API || true,
|
|
27
|
+
swapi: {
|
|
28
|
+
uri: process.env.API_URI || "https://swapi.dev/api/people/",
|
|
29
|
+
configs: {
|
|
30
|
+
method: process.env.API_METHOD ||"GET",
|
|
31
|
+
url: process.env.API_OBJ_URL || "",
|
|
32
|
+
headers: {
|
|
33
|
+
"Content-Type": "application/json",
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
};
|
|
35
38
|
};
|
|
39
|
+
module.exports = config;
|
|
40
|
+
|
|
@@ -1,35 +1,38 @@
|
|
|
1
1
|
/*
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* _| _| _| _| _|_|_|
|
|
3
|
+
* _| _| _|_| _|_| _| _|
|
|
4
|
+
* _| _| _| _| _| _| _|
|
|
5
|
+
* _| _| _| _| _| _|
|
|
6
|
+
* _| _| _| _|_|_|
|
|
7
|
+
* EspressoJS - EspressoJS / Espresso
|
|
8
|
+
* Global Template w/ API
|
|
6
9
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
},
|
|
10
|
+
require("dotenv").config();
|
|
11
|
+
const fs = require("fs");
|
|
12
|
+
const configBuffer = fs.readFileSync("./config.json"),
|
|
13
|
+
data = JSON.parse(configBuffer.toString());
|
|
14
|
+
const config = () => {
|
|
15
|
+
return {
|
|
16
|
+
env: data.instance || "development",
|
|
17
|
+
hostname: data.hostname || "global.example.com",
|
|
18
|
+
port: data.instance || "8080",
|
|
19
|
+
mongo_isEnabled: data.mongoDB || false,
|
|
20
|
+
mongo: {
|
|
21
|
+
uri: process.env.MONGO_URI || "localhost",
|
|
22
|
+
port: process.env.MONGO_URI_PORT || "",
|
|
23
|
+
db: process.env.MONGO_URI_DB || "",
|
|
24
|
+
},
|
|
25
|
+
swapi_isEnabled: data.API ? data.API : true || true,
|
|
26
|
+
swapi: {
|
|
27
|
+
uri: process.env.API_URI || "https://swapi.dev/api/",
|
|
28
|
+
configs: {
|
|
29
|
+
method: process.env.API_METHOD || "GET",
|
|
30
|
+
url: process.env.API_OBJ_URL || "",
|
|
31
|
+
headers: {
|
|
32
|
+
"Content-Type": "application/json",
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
};
|
|
35
37
|
};
|
|
38
|
+
module.exports = config;
|
|
@@ -1,35 +1,38 @@
|
|
|
1
1
|
/*
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* _| _| _| _| _|_|_|
|
|
3
|
+
* _| _| _|_| _|_| _| _|
|
|
4
|
+
* _| _| _| _| _| _| _|
|
|
5
|
+
* _| _| _| _| _| _|
|
|
6
|
+
* _| _| _| _|_|_|
|
|
7
|
+
* EspressoJS - EspressoJS / Espresso
|
|
8
|
+
* Production Template
|
|
6
9
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
},
|
|
10
|
+
require("dotenv").config();
|
|
11
|
+
const fs = require("fs");
|
|
12
|
+
const configBuffer = fs.readFileSync("./config.json"),
|
|
13
|
+
data = JSON.parse(configBuffer.toString());
|
|
14
|
+
const config = () => {
|
|
15
|
+
return {
|
|
16
|
+
env: data.instance || "production",
|
|
17
|
+
hostname: data.hostname || "www.example.com",
|
|
18
|
+
port: data.instance || "80",
|
|
19
|
+
mongo_isEnabled: data.mongoDB || false,
|
|
20
|
+
mongo: {
|
|
21
|
+
uri: process.env.MONGO_URI || "localhost",
|
|
22
|
+
port: process.env.MONGO_URI_PORT || "27017",
|
|
23
|
+
db: process.env.MONGO_URI_DB || "clients",
|
|
24
|
+
},
|
|
25
|
+
swapi_isEnabled: data.API || false,
|
|
26
|
+
swapi: {
|
|
27
|
+
uri: process.env.API_URI || "https://swapi.dev/api/people/",
|
|
28
|
+
configs: {
|
|
29
|
+
method: process.env.API_METHOD || "GET",
|
|
30
|
+
url: process.env.API_OBJ_URL || "",
|
|
31
|
+
headers: {
|
|
32
|
+
"Content-Type": "application/json",
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
};
|
|
35
37
|
};
|
|
38
|
+
module.exports = config;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
1
|
+
/*
|
|
2
|
+
* _| _| _| _| _|_|_|
|
|
3
|
+
* _| _| _|_| _|_| _| _|
|
|
4
|
+
* _| _| _| _| _| _| _|
|
|
5
|
+
* _| _| _| _| _| _|
|
|
6
|
+
* _| _| _| _|_|_|
|
|
7
|
+
* EspressoJS - EspressoJS / Espresso is your one-stop
|
|
8
|
+
* Express Configuration starting point
|
|
6
9
|
*/
|
|
7
|
-
|
|
8
10
|
const Client = require("../../models/client.model.js");
|
|
9
11
|
|
|
10
12
|
/**
|
package/server/index.js
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
/*
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* _| _| _| _| _|_|_|
|
|
3
|
+
* _| _| _|_| _|_| _| _|
|
|
4
|
+
* _| _| _| _| _| _| _|
|
|
5
|
+
* _| _| _| _| _| _|
|
|
6
|
+
* _| _| _| _|_|_|
|
|
7
|
+
* EspressoJS
|
|
6
8
|
*/
|
|
7
9
|
const fs = require("fs");
|
|
8
|
-
|
|
9
10
|
require("dotenv").config();
|
|
10
11
|
const configBuffer = fs.readFileSync("./config.json"),
|
|
11
|
-
|
|
12
|
-
data = JSON.parse(dataJSON);
|
|
13
|
-
|
|
12
|
+
data = JSON.parse(configBuffer.toString());
|
|
14
13
|
const env = data.instance || process.env.NODE_ENV || "development";
|
|
15
14
|
const cfg = require("./config/config." + env);
|
|
16
|
-
|
|
17
15
|
module.exports = cfg;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
1
|
+
/*
|
|
2
|
+
* _| _| _| _| _|_|_|
|
|
3
|
+
* _| _| _|_| _|_| _| _|
|
|
4
|
+
* _| _| _| _| _| _| _|
|
|
5
|
+
* _| _| _| _| _| _|
|
|
6
|
+
* _| _| _| _|_|_|
|
|
5
7
|
* MongoDB Schema Example
|
|
6
8
|
*/
|
|
7
|
-
|
|
8
9
|
const mongoose = require("mongoose");
|
|
9
10
|
const clientSchema = mongoose.Schema(
|
|
10
11
|
{
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/*
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* _| _| _| _| _|_|_|
|
|
3
|
+
* _| _| _|_| _|_| _| _|
|
|
4
|
+
* _| _| _| _| _| _| _|
|
|
5
|
+
* _| _| _| _| _| _|
|
|
6
|
+
* _| _| _| _|_|_|
|
|
7
|
+
* EspressoJS - CLI
|
|
6
8
|
*/
|
|
7
|
-
|
|
8
9
|
const fs = require("fs");
|
|
9
10
|
const { exec } = require("child_process");
|
|
10
11
|
const { string, number } = require("yargs");
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/*
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* _| _| _| _| _|_|_|
|
|
3
|
+
* _| _| _|_| _|_| _| _|
|
|
4
|
+
* _| _| _| _| _| _| _|
|
|
5
|
+
* _| _| _| _| _| _|
|
|
6
|
+
* _| _| _| _|_|_|
|
|
7
|
+
* EspressoJS - INIT
|
|
6
8
|
*/
|
|
7
|
-
|
|
8
9
|
module.exports = (app) => {
|
|
9
10
|
const fs = require("fs");
|
|
10
11
|
const cfg = require("./../");
|