@misterzik/espressojs 3.1.20 → 3.2.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@misterzik/espressojs",
3
- "version": "3.1.20",
3
+ "version": "3.2.1",
4
4
  "description": "EspressoJS Introducing Espresso.JS, your ultimate Express configuration starting point and boilerplate. With its simplicity and lack of opinionation, EspressoJS offers plug-and-play configurations built on top of Express.",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/routes/index.js CHANGED
@@ -11,8 +11,8 @@
11
11
 
12
12
  const Path = require("path");
13
13
  const configuration = require("../server");
14
- const api = require("./api");
15
- const db = require("./db");
14
+ const api = require(path.join(rootDir, "routes", "api.js"));
15
+ const db = require(path.join(rootDir, "routes", "db.js"));
16
16
 
17
17
  module.exports = (app) => {
18
18
  app.get("/", function (res) {
@@ -22,7 +22,7 @@ module.exports = (app) => {
22
22
  app.use("/api", api);
23
23
  }
24
24
  if (configuration.mongo_isEnabled === true) {
25
- db(app);
25
+ app.use("/api", db);
26
26
  }
27
27
  app.use(function (req, res, next) {
28
28
  res.status(404).send("404 - Sorry can't find that!");
@@ -1,23 +0,0 @@
1
- /*
2
- * _| _| _| _| _|_|_|
3
- * _| _| _|_| _|_| _| _|
4
- * _| _| _| _| _| _| _|
5
- * _| _| _| _| _| _|
6
- * _| _| _| _|_|_|
7
- * EspressoJS - API Routers
8
- */
9
-
10
- const express = require("express");
11
- const router = express.Router();
12
- const { getAPI, getItem, getItemId } = require("../utils");
13
- router.get("/v1/", (req, res) => {
14
- getAPI(req, res);
15
- });
16
- router.get("/v1/:item", (req, res, next) => {
17
- getItem(req, res, req.params.item);
18
- });
19
- router.get("/v1/:item/:itemId", (req, res, next) => {
20
- getItemId(req, res, req.params.item, req.params.itemId);
21
- });
22
-
23
- module.exports = router;
@@ -1,37 +0,0 @@
1
- /*
2
- * _| _| _| _| _|_|_|
3
- * _| _| _|_| _|_| _| _|
4
- * _| _| _| _| _| _| _|
5
- * _| _| _| _| _| _|
6
- * _| _| _| _|_|_|
7
- * EspressoJS - Client Model
8
- * --
9
- * Basic Clients Collection - API CRUD
10
- * @param {*} app - Vimedev.com Labs
11
- */
12
-
13
- const clientController = require("../../server/controllers");
14
- const url = "/api/clients/";
15
-
16
- module.exports = (app) => {
17
- /* Get All */
18
- app.get(url, (req, res) => {
19
- clientController.findAll("client", req, res);
20
- });
21
- /* Create */
22
- app.post(url, (req, res) => {
23
- clientController.create("client", req, res);
24
- });
25
- /* Retrieve a single Note with clientId */
26
- app.get(url + ":clientId", (req, res) => {
27
- clientController.findOne("client", req, res);
28
- });
29
- /** Update a Note with clientId */
30
- app.put(url + ":clientId", (req, res) => {
31
- clientController.update("client", req, res);
32
- });
33
- /* Delete a Note with clientId */
34
- app.delete(url + ":clientId", (req, res) => {
35
- clientController.delete("client", req, res);
36
- });
37
- };