@seip/blue-bird 0.3.3 → 0.3.4
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_example +23 -13
- package/LICENSE +21 -21
- package/README.md +79 -79
- package/backend/index.js +12 -12
- package/backend/routes/api.js +34 -34
- package/backend/routes/frontend.js +1 -8
- package/core/app.js +359 -359
- package/core/auth.js +69 -69
- package/core/cache.js +35 -35
- package/core/cli/component.js +42 -42
- package/core/cli/init.js +120 -118
- package/core/cli/react.js +383 -411
- package/core/cli/route.js +42 -42
- package/core/cli/scaffolding-auth.js +967 -0
- package/core/config.js +41 -41
- package/core/debug.js +248 -248
- package/core/logger.js +80 -80
- package/core/middleware.js +27 -27
- package/core/router.js +134 -134
- package/core/swagger.js +24 -24
- package/core/template.js +288 -288
- package/core/upload.js +76 -76
- package/core/validate.js +291 -290
- package/frontend/index.html +28 -22
- package/frontend/resources/js/App.jsx +28 -42
- package/frontend/resources/js/Main.jsx +17 -17
- package/frontend/resources/js/blue-bird/components/Button.jsx +67 -0
- package/frontend/resources/js/blue-bird/components/Card.jsx +17 -0
- package/frontend/resources/js/blue-bird/components/DataTable.jsx +126 -0
- package/frontend/resources/js/blue-bird/components/Input.jsx +21 -0
- package/frontend/resources/js/blue-bird/components/Label.jsx +12 -0
- package/frontend/resources/js/blue-bird/components/Modal.jsx +27 -0
- package/frontend/resources/js/blue-bird/components/Translate.jsx +12 -0
- package/frontend/resources/js/blue-bird/components/Typography.jsx +25 -0
- package/frontend/resources/js/blue-bird/contexts/LanguageContext.jsx +29 -0
- package/frontend/resources/js/blue-bird/contexts/SnackbarContext.jsx +38 -0
- package/frontend/resources/js/blue-bird/contexts/ThemeContext.jsx +49 -0
- package/frontend/resources/js/blue-bird/locales/en.json +30 -0
- package/frontend/resources/js/blue-bird/locales/es.json +30 -0
- package/frontend/resources/js/pages/About.jsx +33 -15
- package/frontend/resources/js/pages/Home.jsx +93 -68
- package/package.json +56 -55
- package/vite.config.js +21 -21
package/core/logger.js
CHANGED
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
import fs from "node:fs";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import Config from "./config.js"
|
|
4
|
-
|
|
5
|
-
const __dirname = Config.dirname()
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Logger class for managing application logs by creating dated folders and log files.
|
|
9
|
-
*/
|
|
10
|
-
class Logger {
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Initializes the Logger instance and ensures the logs directory exists.
|
|
14
|
-
*/
|
|
15
|
-
constructor() {
|
|
16
|
-
this.folder = path.join(__dirname, "logs");
|
|
17
|
-
if (!fs.existsSync(this.folder)) {
|
|
18
|
-
fs.mkdirSync(this.folder, { recursive: true });
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Ensures and returns the path to the log folder for the current day.
|
|
24
|
-
* @returns {string} The absolute path to the current day's log folder.
|
|
25
|
-
*/
|
|
26
|
-
nowFolder() {
|
|
27
|
-
const folder = path.join(this.folder, this.now());
|
|
28
|
-
|
|
29
|
-
if (!fs.existsSync(folder)) {
|
|
30
|
-
fs.mkdirSync(folder, { recursive: true });
|
|
31
|
-
}
|
|
32
|
-
return folder;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Gets the current date formatted as YYYY-MM-DD.
|
|
37
|
-
* @returns {string} The formatted date string.
|
|
38
|
-
*/
|
|
39
|
-
now() {
|
|
40
|
-
return new Date().toISOString().split("T")[0];
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Appends an informational message to the info.log file.
|
|
45
|
-
* @param {string} message - The message to log.
|
|
46
|
-
*/
|
|
47
|
-
info(message) {
|
|
48
|
-
const logFile = path.join(this.nowFolder(), 'info.log');
|
|
49
|
-
fs.appendFileSync(logFile, `${message}\n`);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Appends an error message to the error.log file.
|
|
54
|
-
* @param {string} message - The error message to log.
|
|
55
|
-
*/
|
|
56
|
-
error(message) {
|
|
57
|
-
const logFile = path.join(this.nowFolder(), 'error.log');
|
|
58
|
-
fs.appendFileSync(logFile, `${message}\n`);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Appends a warning message to the warn.log file.
|
|
63
|
-
* @param {string} message - The warning message to log.
|
|
64
|
-
*/
|
|
65
|
-
warning(message) {
|
|
66
|
-
const logFile = path.join(this.nowFolder(), 'warn.log');
|
|
67
|
-
fs.appendFileSync(logFile, `${message}\n`);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Appends a debug message to the debug.log file.
|
|
72
|
-
* @param {string} message - The debug message to log.
|
|
73
|
-
*/
|
|
74
|
-
debug(message) {
|
|
75
|
-
const logFile = path.join(this.nowFolder(), 'debug.log');
|
|
76
|
-
fs.appendFileSync(logFile, `${message}\n`);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export default Logger;
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import Config from "./config.js"
|
|
4
|
+
|
|
5
|
+
const __dirname = Config.dirname()
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Logger class for managing application logs by creating dated folders and log files.
|
|
9
|
+
*/
|
|
10
|
+
class Logger {
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Initializes the Logger instance and ensures the logs directory exists.
|
|
14
|
+
*/
|
|
15
|
+
constructor() {
|
|
16
|
+
this.folder = path.join(__dirname, "logs");
|
|
17
|
+
if (!fs.existsSync(this.folder)) {
|
|
18
|
+
fs.mkdirSync(this.folder, { recursive: true });
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Ensures and returns the path to the log folder for the current day.
|
|
24
|
+
* @returns {string} The absolute path to the current day's log folder.
|
|
25
|
+
*/
|
|
26
|
+
nowFolder() {
|
|
27
|
+
const folder = path.join(this.folder, this.now());
|
|
28
|
+
|
|
29
|
+
if (!fs.existsSync(folder)) {
|
|
30
|
+
fs.mkdirSync(folder, { recursive: true });
|
|
31
|
+
}
|
|
32
|
+
return folder;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Gets the current date formatted as YYYY-MM-DD.
|
|
37
|
+
* @returns {string} The formatted date string.
|
|
38
|
+
*/
|
|
39
|
+
now() {
|
|
40
|
+
return new Date().toISOString().split("T")[0];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Appends an informational message to the info.log file.
|
|
45
|
+
* @param {string} message - The message to log.
|
|
46
|
+
*/
|
|
47
|
+
info(message) {
|
|
48
|
+
const logFile = path.join(this.nowFolder(), 'info.log');
|
|
49
|
+
fs.appendFileSync(logFile, `${message}\n`);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Appends an error message to the error.log file.
|
|
54
|
+
* @param {string} message - The error message to log.
|
|
55
|
+
*/
|
|
56
|
+
error(message) {
|
|
57
|
+
const logFile = path.join(this.nowFolder(), 'error.log');
|
|
58
|
+
fs.appendFileSync(logFile, `${message}\n`);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Appends a warning message to the warn.log file.
|
|
63
|
+
* @param {string} message - The warning message to log.
|
|
64
|
+
*/
|
|
65
|
+
warning(message) {
|
|
66
|
+
const logFile = path.join(this.nowFolder(), 'warn.log');
|
|
67
|
+
fs.appendFileSync(logFile, `${message}\n`);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Appends a debug message to the debug.log file.
|
|
72
|
+
* @param {string} message - The debug message to log.
|
|
73
|
+
*/
|
|
74
|
+
debug(message) {
|
|
75
|
+
const logFile = path.join(this.nowFolder(), 'debug.log');
|
|
76
|
+
fs.appendFileSync(logFile, `${message}\n`);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export default Logger;
|
package/core/middleware.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import Auth from "./auth.js";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Common middlewares for the Blue Bird framework.
|
|
5
|
-
*/
|
|
6
|
-
const Middleware = {
|
|
7
|
-
/**
|
|
8
|
-
* Authentication protection middleware.
|
|
9
|
-
* @type {Function}
|
|
10
|
-
*/
|
|
11
|
-
auth: Auth.protect(),
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Web authentication protection middleware (redirects to home if fails).
|
|
15
|
-
* @type {Function}
|
|
16
|
-
*/
|
|
17
|
-
webAuth: Auth.protect({ redirect: "/" }),
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Logging middleware (can be extended).
|
|
21
|
-
*/
|
|
22
|
-
logger: (req, res, next) => {
|
|
23
|
-
next();
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export default Middleware;
|
|
1
|
+
import Auth from "./auth.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Common middlewares for the Blue Bird framework.
|
|
5
|
+
*/
|
|
6
|
+
const Middleware = {
|
|
7
|
+
/**
|
|
8
|
+
* Authentication protection middleware.
|
|
9
|
+
* @type {Function}
|
|
10
|
+
*/
|
|
11
|
+
auth: Auth.protect(),
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Web authentication protection middleware (redirects to home if fails).
|
|
15
|
+
* @type {Function}
|
|
16
|
+
*/
|
|
17
|
+
webAuth: Auth.protect({ redirect: "/" }),
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Logging middleware (can be extended).
|
|
21
|
+
*/
|
|
22
|
+
logger: (req, res, next) => {
|
|
23
|
+
next();
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export default Middleware;
|
package/core/router.js
CHANGED
|
@@ -1,135 +1,135 @@
|
|
|
1
|
-
import express from "express";
|
|
2
|
-
import Config from "./config.js";
|
|
3
|
-
|
|
4
|
-
const __dirname = Config.dirname()
|
|
5
|
-
const props = Config.props()
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Router wrapper class for handling Express routing logic.
|
|
9
|
-
*/
|
|
10
|
-
class Router {
|
|
11
|
-
/**
|
|
12
|
-
* Creates a new Router instance.
|
|
13
|
-
* @param {string} [path="/"] - The base path for this router.
|
|
14
|
-
* @example
|
|
15
|
-
* const router = new Router("/api")
|
|
16
|
-
* router.get("/", (req, res) => {
|
|
17
|
-
* res.json({ message: "Hello World!" })
|
|
18
|
-
* })
|
|
19
|
-
*/
|
|
20
|
-
constructor(path = "/") {
|
|
21
|
-
this.router = express.Router()
|
|
22
|
-
this.path = path
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Registers a GET route handler.
|
|
27
|
-
* @param {string} path - The relative path for the GET route.
|
|
28
|
-
* @param {...Function} callback - One or more handler functions (middlewares and controller).
|
|
29
|
-
* @example
|
|
30
|
-
* router.get("/users", (req, res) => {
|
|
31
|
-
* const users = [
|
|
32
|
-
* {
|
|
33
|
-
* name: "John Doe",
|
|
34
|
-
* email: "john.doe@example.com",
|
|
35
|
-
* },
|
|
36
|
-
* {
|
|
37
|
-
* name: "Jane Doe2",
|
|
38
|
-
* email: "jane.doe2@example.com",
|
|
39
|
-
* },
|
|
40
|
-
* ]
|
|
41
|
-
* res.json(users)
|
|
42
|
-
* })
|
|
43
|
-
*/
|
|
44
|
-
get(path, ...callback) {
|
|
45
|
-
if (path === "/*" || path === "*") {
|
|
46
|
-
path = /.*/
|
|
47
|
-
}
|
|
48
|
-
this.router.get(path, callback)
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Registers a POST route handler.
|
|
53
|
-
* @param {string} path - The relative path for the POST route.
|
|
54
|
-
* @param {...Function} callback - One or more handler functions (middlewares and controller).
|
|
55
|
-
* @example
|
|
56
|
-
* router.post("/users", (req, res) => {
|
|
57
|
-
* return res.json({ message: "User created successfully" })
|
|
58
|
-
* })
|
|
59
|
-
*/
|
|
60
|
-
post(path, ...callback) {
|
|
61
|
-
if (path === "/*" || path === "*") {
|
|
62
|
-
path = /.*/
|
|
63
|
-
}
|
|
64
|
-
this.router.post(path, callback)
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Registers a PUT route handler.
|
|
69
|
-
* @param {string} path - The relative path for the PUT route.
|
|
70
|
-
* @param {...Function} callback - One or more handler functions (middlewares and controller).
|
|
71
|
-
* @example
|
|
72
|
-
* router.put("/users", (req, res) => {
|
|
73
|
-
* return res.json({ message: "User updated successfully" })
|
|
74
|
-
* })
|
|
75
|
-
*/
|
|
76
|
-
put(path, ...callback) {
|
|
77
|
-
this.router.put(path, callback)
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Registers a DELETE route handler.
|
|
82
|
-
* @param {string} path - The relative path for the DELETE route.
|
|
83
|
-
* @param {...Function} callback - One or more handler functions (middlewares and controller).
|
|
84
|
-
* @example
|
|
85
|
-
* router.delete("/users", (req, res) => {
|
|
86
|
-
* return res.json({ message: "User deleted successfully" })
|
|
87
|
-
* })
|
|
88
|
-
*/
|
|
89
|
-
delete(path, ...callback) {
|
|
90
|
-
this.router.delete(path, callback)
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Registers a PATCH route handler.
|
|
95
|
-
* @param {string} path - The relative path for the PATCH route.
|
|
96
|
-
* @param {...Function} callback - One or more handler functions (middlewares and controller).
|
|
97
|
-
* @example
|
|
98
|
-
* router.patch("/users", (req, res) => {
|
|
99
|
-
* return res.json({ message: "User patched successfully" })
|
|
100
|
-
* })
|
|
101
|
-
*/
|
|
102
|
-
patch(path, ...callback) {
|
|
103
|
-
this.router.patch(path, callback)
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Registers an OPTIONS route handler.
|
|
108
|
-
* @param {string} path - The relative path for the OPTIONS route.
|
|
109
|
-
* @param {...Function} callback - One or more handler functions (middlewares and controller).
|
|
110
|
-
* @example
|
|
111
|
-
* router.options("/users", (req, res) => {
|
|
112
|
-
* return res.json({ message: "User options successfully" })
|
|
113
|
-
* })
|
|
114
|
-
*/
|
|
115
|
-
options(path, ...callback) {
|
|
116
|
-
this.router.options(path, callback)
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Returns the underlying Express router instance.
|
|
121
|
-
* @returns {import('express').Router} The Express router object.
|
|
122
|
-
*/
|
|
123
|
-
getRouter() {
|
|
124
|
-
return this.router
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Returns the base path associated with this router.
|
|
129
|
-
* @returns {string} The router path.
|
|
130
|
-
*/
|
|
131
|
-
getPath() {
|
|
132
|
-
return this.path
|
|
133
|
-
}
|
|
134
|
-
}
|
|
1
|
+
import express from "express";
|
|
2
|
+
import Config from "./config.js";
|
|
3
|
+
|
|
4
|
+
const __dirname = Config.dirname()
|
|
5
|
+
const props = Config.props()
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Router wrapper class for handling Express routing logic.
|
|
9
|
+
*/
|
|
10
|
+
class Router {
|
|
11
|
+
/**
|
|
12
|
+
* Creates a new Router instance.
|
|
13
|
+
* @param {string} [path="/"] - The base path for this router.
|
|
14
|
+
* @example
|
|
15
|
+
* const router = new Router("/api")
|
|
16
|
+
* router.get("/", (req, res) => {
|
|
17
|
+
* res.json({ message: "Hello World!" })
|
|
18
|
+
* })
|
|
19
|
+
*/
|
|
20
|
+
constructor(path = "/") {
|
|
21
|
+
this.router = express.Router()
|
|
22
|
+
this.path = path
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Registers a GET route handler.
|
|
27
|
+
* @param {string} path - The relative path for the GET route.
|
|
28
|
+
* @param {...Function} callback - One or more handler functions (middlewares and controller).
|
|
29
|
+
* @example
|
|
30
|
+
* router.get("/users", (req, res) => {
|
|
31
|
+
* const users = [
|
|
32
|
+
* {
|
|
33
|
+
* name: "John Doe",
|
|
34
|
+
* email: "john.doe@example.com",
|
|
35
|
+
* },
|
|
36
|
+
* {
|
|
37
|
+
* name: "Jane Doe2",
|
|
38
|
+
* email: "jane.doe2@example.com",
|
|
39
|
+
* },
|
|
40
|
+
* ]
|
|
41
|
+
* res.json(users)
|
|
42
|
+
* })
|
|
43
|
+
*/
|
|
44
|
+
get(path, ...callback) {
|
|
45
|
+
if (path === "/*" || path === "*") {
|
|
46
|
+
path = /.*/
|
|
47
|
+
}
|
|
48
|
+
this.router.get(path, callback)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Registers a POST route handler.
|
|
53
|
+
* @param {string} path - The relative path for the POST route.
|
|
54
|
+
* @param {...Function} callback - One or more handler functions (middlewares and controller).
|
|
55
|
+
* @example
|
|
56
|
+
* router.post("/users", (req, res) => {
|
|
57
|
+
* return res.json({ message: "User created successfully" })
|
|
58
|
+
* })
|
|
59
|
+
*/
|
|
60
|
+
post(path, ...callback) {
|
|
61
|
+
if (path === "/*" || path === "*") {
|
|
62
|
+
path = /.*/
|
|
63
|
+
}
|
|
64
|
+
this.router.post(path, callback)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Registers a PUT route handler.
|
|
69
|
+
* @param {string} path - The relative path for the PUT route.
|
|
70
|
+
* @param {...Function} callback - One or more handler functions (middlewares and controller).
|
|
71
|
+
* @example
|
|
72
|
+
* router.put("/users", (req, res) => {
|
|
73
|
+
* return res.json({ message: "User updated successfully" })
|
|
74
|
+
* })
|
|
75
|
+
*/
|
|
76
|
+
put(path, ...callback) {
|
|
77
|
+
this.router.put(path, callback)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Registers a DELETE route handler.
|
|
82
|
+
* @param {string} path - The relative path for the DELETE route.
|
|
83
|
+
* @param {...Function} callback - One or more handler functions (middlewares and controller).
|
|
84
|
+
* @example
|
|
85
|
+
* router.delete("/users", (req, res) => {
|
|
86
|
+
* return res.json({ message: "User deleted successfully" })
|
|
87
|
+
* })
|
|
88
|
+
*/
|
|
89
|
+
delete(path, ...callback) {
|
|
90
|
+
this.router.delete(path, callback)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Registers a PATCH route handler.
|
|
95
|
+
* @param {string} path - The relative path for the PATCH route.
|
|
96
|
+
* @param {...Function} callback - One or more handler functions (middlewares and controller).
|
|
97
|
+
* @example
|
|
98
|
+
* router.patch("/users", (req, res) => {
|
|
99
|
+
* return res.json({ message: "User patched successfully" })
|
|
100
|
+
* })
|
|
101
|
+
*/
|
|
102
|
+
patch(path, ...callback) {
|
|
103
|
+
this.router.patch(path, callback)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Registers an OPTIONS route handler.
|
|
108
|
+
* @param {string} path - The relative path for the OPTIONS route.
|
|
109
|
+
* @param {...Function} callback - One or more handler functions (middlewares and controller).
|
|
110
|
+
* @example
|
|
111
|
+
* router.options("/users", (req, res) => {
|
|
112
|
+
* return res.json({ message: "User options successfully" })
|
|
113
|
+
* })
|
|
114
|
+
*/
|
|
115
|
+
options(path, ...callback) {
|
|
116
|
+
this.router.options(path, callback)
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Returns the underlying Express router instance.
|
|
121
|
+
* @returns {import('express').Router} The Express router object.
|
|
122
|
+
*/
|
|
123
|
+
getRouter() {
|
|
124
|
+
return this.router
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Returns the base path associated with this router.
|
|
129
|
+
* @returns {string} The router path.
|
|
130
|
+
*/
|
|
131
|
+
getPath() {
|
|
132
|
+
return this.path
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
135
|
export default Router;
|
package/core/swagger.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import swaggerUi from "swagger-ui-express";
|
|
2
|
-
import swaggerJSDoc from "swagger-jsdoc";
|
|
3
|
-
|
|
4
|
-
class Swagger {
|
|
5
|
-
|
|
6
|
-
static init(app, options) {
|
|
7
|
-
|
|
8
|
-
const optionsJsDoc = {
|
|
9
|
-
definition: {
|
|
10
|
-
openapi: "3.0.0",
|
|
11
|
-
info: options.info,
|
|
12
|
-
servers: [
|
|
13
|
-
{ url: options.url }
|
|
14
|
-
]
|
|
15
|
-
},
|
|
16
|
-
apis: ["./backend/routes/*.js"]
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const specs = swaggerJSDoc(optionsJsDoc);
|
|
20
|
-
|
|
21
|
-
app.use("/docs", swaggerUi.serve, swaggerUi.setup(specs));
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
1
|
+
import swaggerUi from "swagger-ui-express";
|
|
2
|
+
import swaggerJSDoc from "swagger-jsdoc";
|
|
3
|
+
|
|
4
|
+
class Swagger {
|
|
5
|
+
|
|
6
|
+
static init(app, options) {
|
|
7
|
+
|
|
8
|
+
const optionsJsDoc = {
|
|
9
|
+
definition: {
|
|
10
|
+
openapi: "3.0.0",
|
|
11
|
+
info: options.info,
|
|
12
|
+
servers: [
|
|
13
|
+
{ url: options.url }
|
|
14
|
+
]
|
|
15
|
+
},
|
|
16
|
+
apis: ["./backend/routes/*.js"]
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const specs = swaggerJSDoc(optionsJsDoc);
|
|
20
|
+
|
|
21
|
+
app.use("/docs", swaggerUi.serve, swaggerUi.setup(specs));
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
25
|
export default Swagger;
|