@seip/blue-bird 0.7.6 → 0.9.0

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.
Files changed (40) hide show
  1. package/.env_example +34 -34
  2. package/AGENTS.md +174 -249
  3. package/LICENSE +21 -21
  4. package/README.md +331 -367
  5. package/{index.js → backend/index.js} +22 -30
  6. package/backend/routes/api.js +57 -57
  7. package/core/app.js +338 -402
  8. package/core/auth.js +262 -256
  9. package/core/cache.js +174 -174
  10. package/core/cli/docker.js +488 -457
  11. package/core/cli/init.js +333 -337
  12. package/core/cli/route.js +42 -42
  13. package/core/config.js +52 -52
  14. package/core/database.js +263 -263
  15. package/core/debug.js +248 -248
  16. package/core/logger.js +115 -115
  17. package/core/middleware.js +27 -27
  18. package/core/router.js +144 -144
  19. package/core/swagger.js +40 -40
  20. package/core/upload.js +77 -77
  21. package/core/validate.js +380 -380
  22. package/docker/Dockerfile +16 -16
  23. package/docker/docker-compose.dev.yml +6 -0
  24. package/docker/docker-compose.mysql.yml +92 -92
  25. package/docker/docker-compose.none.yml +68 -68
  26. package/docker/docker-compose.postgres.yml +93 -93
  27. package/docker/nginx.conf +98 -106
  28. package/docker-compose.yml +92 -92
  29. package/frontend/about.html +103 -0
  30. package/frontend/images/favicon.ico +0 -0
  31. package/frontend/index.html +141 -0
  32. package/frontend/js/tailwind.js +8 -0
  33. package/package.json +64 -71
  34. package/frontend/astro.config.mjs +0 -35
  35. package/frontend/public/css/app.css +0 -319
  36. package/frontend/public/favicon.ico +0 -0
  37. package/frontend/src/http/api.js +0 -29
  38. package/frontend/src/layouts/Layout.astro +0 -20
  39. package/frontend/src/pages/about.astro +0 -54
  40. package/frontend/src/pages/index.astro +0 -110
@@ -1,30 +1,22 @@
1
- import App from "@seip/blue-bird/core/app.js";
2
- import routerApi from "./backend/routes/api.js";
3
-
4
- /**
5
- * Main entry point for the Blue Bird application.
6
- * Initializes the App instance with routes, configuration, and starts the server.
7
- */
8
- const app = new App({
9
- routes: [routerApi],
10
-
11
- cors: [],
12
-
13
- middlewares: [],
14
-
15
- host: "http://localhost",
16
-
17
- port: process.env.PORT,
18
-
19
- logger: true, //In production, set this to false to disable logging and stop writing to Redis
20
-
21
- astro: {
22
- server: true,
23
- serverEntry: "./frontend/dist/server/entry.mjs",
24
- client: true,
25
- clientDir: "./frontend/dist/client",
26
- base: "/",
27
- },
28
- });
29
-
30
- app.run();
1
+ import App from "@seip/blue-bird/core/app.js";
2
+ import routerApi from "./routes/api.js";
3
+
4
+ /**
5
+ * Main entry point for the Blue Bird application.
6
+ * Initializes the App instance with routes, configuration, and starts the server.
7
+ */
8
+ const app = new App({
9
+ routes: [routerApi],
10
+
11
+ cors: [],
12
+
13
+ middlewares: [],
14
+
15
+ host: "http://localhost",
16
+
17
+ port: process.env.PORT,
18
+
19
+ logger: false,
20
+ });
21
+
22
+ app.run();
@@ -1,57 +1,57 @@
1
- import Router from "@seip/blue-bird/core/router.js";
2
- import Validator from "@seip/blue-bird/core/validate.js";
3
- import Cache from "@seip/blue-bird/core/cache.js";
4
- import Auth from "@seip/blue-bird/core/auth.js";
5
-
6
- const routerApi = new Router("/api");
7
-
8
- routerApi.get("//", (req, res) => {
9
- res.json({ api: true, message: "Bluebird API", time: Date.now() });
10
- });
11
-
12
- routerApi.get("/users", (req, res) => {
13
- const users = [
14
- {
15
- name: "John Doe",
16
- email: "john.doe@example.com",
17
- },
18
- {
19
- name: "Jane Doe2",
20
- email: "jane.doe2@example.com",
21
- },
22
- ];
23
- res.json(users);
24
- });
25
-
26
- const loginSchema = {
27
- email: { required: true, email: true },
28
- password: { required: true, min: 6 },
29
- };
30
-
31
- const loginValidator = new Validator(loginSchema);
32
-
33
- routerApi.post("/login", loginValidator.middleware(), (req, res) => {
34
- res.json({ message: "Login successful", body: req.body });
35
- });
36
-
37
- routerApi.get("/cache", Cache.middleware(), async (req, res) => {
38
- await new Promise((resolve) => setTimeout(resolve, 2000));
39
- res.json({ message: "Cache successful" });
40
- });
41
-
42
- routerApi.get("/auth_generate", async (req, res) => {
43
- const token = await Auth.login(res, { id: 1, name: "John Doe" }, "auth");
44
- res.json({ message: "Auth successful", token });
45
- });
46
-
47
- routerApi.get("/auth_logout", async (req, res) => {
48
- await Auth.logout(res, "auth", {}, req);
49
- res.json({ message: "Auth successful" });
50
- });
51
-
52
- routerApi.get("/auth_verify", Auth.protect(), (req, res) => {
53
- const userInfo = req.user;
54
- res.json({ message: "Auth successful", user: userInfo });
55
- });
56
-
57
- export default routerApi;
1
+ import Router from "@seip/blue-bird/core/router.js";
2
+ import Validator from "@seip/blue-bird/core/validate.js";
3
+ import Cache from "@seip/blue-bird/core/cache.js";
4
+ import Auth from "@seip/blue-bird/core/auth.js";
5
+
6
+ const routerApi = new Router("/api");
7
+
8
+ routerApi.get("//", (req, res) => {
9
+ res.json({ api: true, message: "Bluebird API", time: Date.now() });
10
+ });
11
+
12
+ routerApi.get("/users", (req, res) => {
13
+ const users = [
14
+ {
15
+ name: "John Doe",
16
+ email: "john.doe@example.com",
17
+ },
18
+ {
19
+ name: "Jane Doe2",
20
+ email: "jane.doe2@example.com",
21
+ },
22
+ ];
23
+ res.json(users);
24
+ });
25
+
26
+ const loginSchema = {
27
+ email: { required: true, email: true },
28
+ password: { required: true, min: 6 },
29
+ };
30
+
31
+ const loginValidator = new Validator(loginSchema);
32
+
33
+ routerApi.post("/login", loginValidator.middleware(), (req, res) => {
34
+ res.json({ message: "Login successful", body: req.body });
35
+ });
36
+
37
+ routerApi.get("/cache", Cache.middleware(), async (req, res) => {
38
+ await new Promise((resolve) => setTimeout(resolve, 2000));
39
+ res.json({ message: "Cache successful" });
40
+ });
41
+
42
+ routerApi.get("/auth_generate", async (req, res) => {
43
+ const token = await Auth.login(res, { id: 1, name: "John Doe" }, "auth");
44
+ res.json({ message: "Auth successful", token });
45
+ });
46
+
47
+ routerApi.get("/auth_logout", async (req, res) => {
48
+ await Auth.logout(res, "auth", {}, req);
49
+ res.json({ message: "Auth successful" });
50
+ });
51
+
52
+ routerApi.get("/auth_verify", Auth.protect(), (req, res) => {
53
+ const userInfo = req.user;
54
+ res.json({ message: "Auth successful", user: userInfo });
55
+ });
56
+
57
+ export default routerApi;