pathlra-aliaser 4.4.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.
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "test-express",
3
+ "version": "1.0.0",
4
+ "main": "index.js",
5
+ "dependencies": {
6
+ "express": "^4.22.1",
7
+ "pathlra-aliaser": "^4.6.11"
8
+ },
9
+ "path_aliaser_": {
10
+ "@products": "./routes/products.js",
11
+ "@users": "./routes/users.js",
12
+ "@logger": "./utils/logger.js"
13
+ },
14
+ "license": "ISC"
15
+ }
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+ const express = require('express');
3
+ const router_routes = express.Router();
4
+
5
+ router_routes.get('/', (req, res) => res.send('all products'));
6
+ router_routes.get('/:id', (req, res) => res.send(`Product ${req.params.id}`));
7
+
8
+ module.exports = router_routes;
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+ const express = require('express');
3
+ const router_routes = express.Router();
4
+
5
+ router_routes.get('/', (req, res) => res.send('all users'));
6
+ router_routes.get('/:id', (req, res) => res.send(`User ${req.params.id}`));
7
+
8
+ module.exports = router_routes;
@@ -0,0 +1,4 @@
1
+ 'use strict';
2
+ module.exports = {
3
+ log: (...args) => console.log('logs', ...args)
4
+ };
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "test-express",
3
+ "version": "1.0.0",
4
+ "main": "test.js",
5
+ "dependencies": {
6
+ "express": "^4.22.1"
7
+ },
8
+ "path_aliaser_": {
9
+ "@productController": "./controllers/productController.js",
10
+ "@userController": "./controllers/userController.js",
11
+ "@products": "./routes/products.js",
12
+ "@users": "./routes/users.js",
13
+ "@logger": "./utils/logger.js"
14
+ }
15
+ }
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+ const express = require('express');
3
+ const router_routes = express.Router();
4
+
5
+ router_routes.get('/', (req, res) => res.send('all products'));
6
+ router_routes.get('/:id', (req, res) => res.send(`Product ${req.params.id}`));
7
+
8
+ module.exports = router_routes;
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+ const express = require('express');
3
+ const router_routes = express.Router();
4
+
5
+ router_routes.get('/', (req, res) => res.send('all users'));
6
+ router_routes.get('/:id', (req, res) => res.send(`User ${req.params.id}`));
7
+
8
+ module.exports = router_routes;
package/test/test.js ADDED
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ const express = require("express");
3
+ const e = express();
4
+ require("../index")(); // pathlra-aliaser 4.6.11
5
+ const productController = require("@productController");
6
+ const userController = require("@userController");
7
+ const productsRoutes = require("@products");
8
+ const usersRoutes = require("@users");
9
+ const logs = require("@logger");
10
+
11
+ e.get("/", (req, res) => {
12
+ res.send(`<h1>Welcome to Test Express Server</h1>
13
+ <p>Server base URL <a href="http://localhost:3001" target="_blank">http://localhost:3001</a></p>
14
+ `);
15
+ });
16
+
17
+ e.use("/products", productsRoutes);
18
+ e.use("/users", usersRoutes);
19
+
20
+ logs.log("All modules loaded successfully");
21
+ console.log(
22
+ "Users routes",
23
+ usersRoutes.stack.map((r) => r.route?.path),
24
+ );
25
+ console.log(
26
+ "Products routes",
27
+ productsRoutes.stack.map((r) => r.route?.path),
28
+ );
29
+
30
+ e.listen(3001, () => logs.log(`Server http://localhost:3001`));
@@ -0,0 +1,6 @@
1
+ 'use strict';
2
+
3
+ module.exports = {
4
+ log: (...args) => console.log('logs', ...args)
5
+ };
6
+