@seip/blue-bird 0.4.3
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 +26 -0
- package/AGENTS.md +199 -0
- package/README.md +79 -0
- package/backend/index.js +13 -0
- package/backend/routes/api.js +31 -0
- package/backend/routes/frontend.js +41 -0
- package/backend/routes/seo.js +39 -0
- package/core/app.js +325 -0
- package/core/auth.js +83 -0
- package/core/cache.js +45 -0
- package/core/cli/component.js +42 -0
- package/core/cli/init.js +118 -0
- package/core/cli/react.js +435 -0
- package/core/cli/route.js +43 -0
- package/core/cli/swagger.js +40 -0
- package/core/config.js +47 -0
- package/core/debug.js +249 -0
- package/core/logger.js +100 -0
- package/core/middleware.js +27 -0
- package/core/router.js +333 -0
- package/core/seo.js +100 -0
- package/core/swagger.js +25 -0
- package/core/template.js +462 -0
- package/core/upload.js +76 -0
- package/core/validate.js +380 -0
- package/frontend/index.html +27 -0
- package/frontend/landing.html +70 -0
- package/frontend/public/favicon.ico +0 -0
- package/frontend/resources/css/tailwind.css +18 -0
- package/frontend/resources/js/App.jsx +70 -0
- package/frontend/resources/js/Main.jsx +19 -0
- package/frontend/resources/js/blue-bird/components/Button.jsx +67 -0
- package/frontend/resources/js/blue-bird/components/Card.jsx +18 -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/LanguageButton.jsx +23 -0
- package/frontend/resources/js/blue-bird/components/Link.jsx +16 -0
- package/frontend/resources/js/blue-bird/components/Modal.jsx +27 -0
- package/frontend/resources/js/blue-bird/components/Skeleton.jsx +45 -0
- package/frontend/resources/js/blue-bird/components/Translate.jsx +12 -0
- package/frontend/resources/js/blue-bird/components/Typography.jsx +69 -0
- package/frontend/resources/js/blue-bird/contexts/LanguageContext.jsx +41 -0
- package/frontend/resources/js/blue-bird/contexts/SPAContext.jsx +237 -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 +48 -0
- package/frontend/resources/js/blue-bird/locales/es.json +48 -0
- package/frontend/resources/js/components/Header.jsx +56 -0
- package/frontend/resources/js/pages/About.jsx +32 -0
- package/frontend/resources/js/pages/Home.jsx +82 -0
- package/package.json +58 -0
- package/vite.config.js +23 -0
package/.env_example
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
DEBUG=true
|
|
2
|
+
DESCRIPTION_META="Example description meta"
|
|
3
|
+
KEYWORDS_META="Example keywords meta"
|
|
4
|
+
TITLE_META="Blue Bird"
|
|
5
|
+
AUTHOR_META="Blue Bird"
|
|
6
|
+
DESCRIPTION="Description project"
|
|
7
|
+
TITLE="Blue Bird"
|
|
8
|
+
VERSION="1.0.0"
|
|
9
|
+
LANGMETA="en"
|
|
10
|
+
HOST="http://localhost"
|
|
11
|
+
PORT=3000
|
|
12
|
+
STATIC_PATH="frontend/public"
|
|
13
|
+
JWT_SECRET="JWT_SECRET"
|
|
14
|
+
|
|
15
|
+
# Database Configuration
|
|
16
|
+
# SQLite (Default)
|
|
17
|
+
#Remove this line if you are not going to use sqlite
|
|
18
|
+
DATABASE_URL="file:./dev.db"
|
|
19
|
+
|
|
20
|
+
# MySQL
|
|
21
|
+
#Remove this line if you are not going to use Mysql
|
|
22
|
+
#DATABASE_URL="mysql://root:@localhost:3306/blue_bird"
|
|
23
|
+
|
|
24
|
+
# PostgreSQL
|
|
25
|
+
#Remove this line if you are not going to use PostgreSQL
|
|
26
|
+
# DATABASE_URL="postgresql://root:@localhost:5432/blue_bird?schema=public"
|
package/AGENTS.md
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
# Blue Bird Framework - AI Agent Guide
|
|
2
|
+
|
|
3
|
+
This document serves as the primary manual for any AI Agent interacting with the codebase. It details the architecture of Blue Bird, its internal modules, and how features should be written or modified.
|
|
4
|
+
|
|
5
|
+
## 1. Core Architecture
|
|
6
|
+
|
|
7
|
+
Blue Bird is a full-stack framework built on **Express (Backend)** and **React + Vite (Frontend)**. It is designed to save developers from repetitive configuration, packing validation, security, authentication (JWT), and multi-language support (i18n) out of the box.
|
|
8
|
+
|
|
9
|
+
- **Backend (`backend/`)**: Initializes the server using `App` from `core/app.js` and invokes routing from `backend/routes/`.
|
|
10
|
+
- **Frontend (`frontend/`)**: A React SPA handled by Vite. Default components and assets live in `frontend/resources/js/`.
|
|
11
|
+
- **Core (`core/`)**: The framework core. Contains wrapper classes such as `Router`, `Validator`, `Template`, `Auth`, `Cache`, etc. **DO NOT MODIFY** the core unless explicitly requested, as it could break other apps.
|
|
12
|
+
|
|
13
|
+
## 2. Routing (Router)
|
|
14
|
+
|
|
15
|
+
Do not use Express' native router (`express.Router()`). Always use Blue Bird's `Router` wrapper.
|
|
16
|
+
|
|
17
|
+
```javascript
|
|
18
|
+
import Router from "@seip/blue-bird/core/router.js";
|
|
19
|
+
|
|
20
|
+
const routerApi = new Router("/api");
|
|
21
|
+
|
|
22
|
+
routerApi.get("/users", (req, res) => {
|
|
23
|
+
res.json({ users: [] });
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export default routerApi;
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
**For the Frontend (React Rendering / SEO):**
|
|
30
|
+
Blue Bird injects the SPA using its `Template` class.
|
|
31
|
+
|
|
32
|
+
```javascript
|
|
33
|
+
import Template from "@seip/blue-bird/core/template.js";
|
|
34
|
+
|
|
35
|
+
// Render the entire App (SPA fallback)
|
|
36
|
+
router.get("*", (req, res) => {
|
|
37
|
+
return Template.renderReact(res, "App", { title: "App Title" });
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
// SEO Routing (Meta tag SSR before React mounts)
|
|
41
|
+
// Automatically registers /sitemap.xml, /robots.txt, and language-prefixed routes
|
|
42
|
+
|
|
43
|
+
// Option A: Simple meta (no i18n)
|
|
44
|
+
router.seo([
|
|
45
|
+
{
|
|
46
|
+
path: "/",
|
|
47
|
+
component: "Home",
|
|
48
|
+
meta: { titleMeta: "Home", descriptionMeta: "Welcome" },
|
|
49
|
+
props: { id: 1 }
|
|
50
|
+
}
|
|
51
|
+
]);
|
|
52
|
+
|
|
53
|
+
// Option B: Multilingual with external seoData file (recommended)
|
|
54
|
+
import seoData from "./seo.js";
|
|
55
|
+
router.seo([
|
|
56
|
+
{ path: "/", component: "Home", seoKey: "home", props: { id: 1 } },
|
|
57
|
+
{ path: "/about", component: "About", seoKey: "about" }
|
|
58
|
+
], { languages: ["en", "es"], defaultLanguage: "en", seoData });
|
|
59
|
+
// Generates: /, /en, /es, /about, /en/about, /es/about
|
|
60
|
+
|
|
61
|
+
// Option C: Multilingual inline meta
|
|
62
|
+
router.seo([
|
|
63
|
+
{
|
|
64
|
+
path: "/",
|
|
65
|
+
component: "Home",
|
|
66
|
+
meta: {
|
|
67
|
+
en: { titleMeta: "Home", descriptionMeta: "Welcome" },
|
|
68
|
+
es: { titleMeta: "Inicio", descriptionMeta: "Bienvenido" }
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
], { languages: ["en", "es"], defaultLanguage: "en" });
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
**Advanced SEO Features:**
|
|
75
|
+
- **SPA Navigation:** When `?source=frontend` is detected, `renderReact` returns JSON `{meta, props, component, lang}` instead of HTML.
|
|
76
|
+
- **Automatic Sitemap:** Dynamic `sitemap.xml` with all language-prefixed routes.
|
|
77
|
+
- **Robots.txt:** Auto-served pointing to the generated sitemap.
|
|
78
|
+
- **Caching:** SEO templates are cached in memory for high performance.
|
|
79
|
+
- **External SEO Data:** Use a `seo.js` file (like PHP's `seo.php`) for centralized multilingual meta management.
|
|
80
|
+
|
|
81
|
+
**Static & Hybrid Rendering (renderHtml):**
|
|
82
|
+
For ultra-fast pages (Landing, Privacy, Terms) that don't initially need React, use `Template.renderHtml`. It fallbacks to `.env` SEO values automatically.
|
|
83
|
+
|
|
84
|
+
```javascript
|
|
85
|
+
router.get("/", (req, res) => {
|
|
86
|
+
// Uses frontend/landing.html as base
|
|
87
|
+
return Template.renderHtml(res, "landing", { withAssets: false });
|
|
88
|
+
});
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
**Strategy: Controlled Collision**
|
|
92
|
+
You can use the same path for a static server page and a React route.
|
|
93
|
+
1. **Initial Load:** Express serves a static, cached HTML (instant LCP).
|
|
94
|
+
2. **Post-Mount:** React Router takes over. Navigation to `/` can then show a different component (like Login) without a full reload.
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
## 3. Data Validation (Validator)
|
|
99
|
+
|
|
100
|
+
Incoming request data must be validated using `core/validate.js`, which automatically returns HTTP 400 multilingual JSON responses on error.
|
|
101
|
+
|
|
102
|
+
```javascript
|
|
103
|
+
import Validator from "@seip/blue-bird/core/validate.js";
|
|
104
|
+
|
|
105
|
+
const userSchema = {
|
|
106
|
+
email: { required: true, email: true },
|
|
107
|
+
password: { required: true, min: 8 },
|
|
108
|
+
bio: { required: false }, // *XSS mitigation is applied to all strings by default!
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
// If you need raw HTML without sanitization, disable XSS explicitly.
|
|
112
|
+
const postSchema = {
|
|
113
|
+
contentHtml: { required: true, xss: false },
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
const validateUser = new Validator(userSchema, "en");
|
|
117
|
+
|
|
118
|
+
routerApi.post("/users", validateUser.middleware(), (req, res) => {
|
|
119
|
+
// Reaching here means data is safe and valid
|
|
120
|
+
res.json({ success: true });
|
|
121
|
+
});
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## 4. Authentication (Auth)
|
|
125
|
+
|
|
126
|
+
The system includes built-in JWT handling. The framework assumes tokens are passed via Cookies or the `Authorization` header.
|
|
127
|
+
|
|
128
|
+
```javascript
|
|
129
|
+
import Auth from "@seip/blue-bird/core/auth.js";
|
|
130
|
+
|
|
131
|
+
// Protect an API route (returns 401 if failed):
|
|
132
|
+
router.get("/profile", Auth.protect(), (req, res) => {
|
|
133
|
+
// The user payload is attached to req.user
|
|
134
|
+
res.json({ user: req.user });
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
// Protect a React route (redirects to login):
|
|
138
|
+
router.get("/dashboard", Auth.protect({ redirect: "/login" }), (req, res) => { ... });
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## 5. Performance Coaching (Cache)
|
|
142
|
+
|
|
143
|
+
If a route involves heavy processing or repetitive DB queries, utilize the in-memory `Cache` middleware.
|
|
144
|
+
|
|
145
|
+
```javascript
|
|
146
|
+
import Cache from "@seip/blue-bird/core/cache.js";
|
|
147
|
+
|
|
148
|
+
// Cache this response for 60 seconds
|
|
149
|
+
router.get("/stats", Cache.middleware(60), (req, res) => {
|
|
150
|
+
// Only executed once every 60s
|
|
151
|
+
res.json({ ok: true });
|
|
152
|
+
});
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## 6. Security (Helmet)
|
|
156
|
+
|
|
157
|
+
Helmet is **not applied globally** by default. Apply it per-router where needed:
|
|
158
|
+
|
|
159
|
+
```javascript
|
|
160
|
+
import App from "@seip/blue-bird/core/app.js";
|
|
161
|
+
|
|
162
|
+
// Apply helmet to a specific router
|
|
163
|
+
const webRouter = new Router("/web");
|
|
164
|
+
webRouter.use(App.helmet()); // Full helmet with defaults
|
|
165
|
+
webRouter.use(App.helmet({ contentSecurityPolicy: false })); // Custom options
|
|
166
|
+
|
|
167
|
+
// Or enable globally in App constructor (not recommended)
|
|
168
|
+
new App({ helmet: true });
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## 7. SPA Navigation (SPAProvider)
|
|
172
|
+
|
|
173
|
+
The framework includes an `SPAProvider` that bridges React Router navigation with backend SEO data.
|
|
174
|
+
On every client-side `<Link>` navigation, it fetches meta/props from the backend and updates `document.title` + meta tags.
|
|
175
|
+
|
|
176
|
+
```javascript
|
|
177
|
+
// In App.jsx — already configured by default
|
|
178
|
+
import { SPAProvider } from './blue-bird/contexts/SPAContext.jsx';
|
|
179
|
+
|
|
180
|
+
<SPAProvider languages={["en", "es"]} defaultLanguage="en">
|
|
181
|
+
<Routes>...</Routes>
|
|
182
|
+
</SPAProvider>
|
|
183
|
+
|
|
184
|
+
// In components — use navigateToLang for language switching
|
|
185
|
+
import { useSPA } from './blue-bird/contexts/SPAContext.jsx';
|
|
186
|
+
const { navigateToLang, pageProps, pageMeta } = useSPA();
|
|
187
|
+
navigateToLang("es"); // Navigates to /es/current-path and updates meta
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
## 8. AI Development Guidelines
|
|
191
|
+
|
|
192
|
+
1. **Frontend**: Components must be Functional React components, leveraging Tailwind CSS. Avoid inline styles. Reuse components from `blue-bird/components/` (e.g., Card, Button, Input) if available.
|
|
193
|
+
2. **JSON Responses**: API endpoints should return standardized responses formatted as `{ message: "..." }` or `{ data: ... }`.
|
|
194
|
+
3. **i18n**: Check the `useLanguage` hook provided in React for multi-language components; avoid hardcoding display strings when localization is active.
|
|
195
|
+
4. **Magic Imports**: Stick to pure relative imports or well-configured aliases (imports natively resolve from `@seip/blue-bird/...` or relative directories like `../../`).
|
|
196
|
+
5. **SPA Navigation**: Use `<Link>` from `react-router-dom` for internal navigation. The `SPAProvider` automatically fetches and updates meta tags.
|
|
197
|
+
6. **Language Routes**: When using multilingual SEO, routes are generated for all language prefixes. Use `navigateToLang()` from `useSPA()` to switch languages.
|
|
198
|
+
|
|
199
|
+
_This file can be retrieved by intelligent agents reading its absolute physical path during reasoning._
|
package/README.md
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# Blue Bird Framework
|
|
2
|
+
|
|
3
|
+
**The Future of Express & React Development**
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/@seip/blue-bird)
|
|
8
|
+
[](https://opensource.org/licenses/MIT)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## 🌟 Introduction / Introducción
|
|
12
|
+
|
|
13
|
+
**Blue Bird** is a powerful, opinionated structure based on **Express** and **React**. It's designed to help developers build fast, scalable applications,apis and everything pre-configured.
|
|
14
|
+
|
|
15
|
+
**Blue Bird** es una estructura potente basada en **Express** y **React**. Está diseñada para ayudar a los desarrolladores a construir aplicaciones rápidas ,apis escalables y todo pre-configurado.
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
## 🚀 Key Features / Características Clave
|
|
20
|
+
|
|
21
|
+
- ⚡ **All-In-One**: Express, React, Vite, JWT Auth, and Validations ready to go.
|
|
22
|
+
- 💎 **Flexible**: Extensible via standard Express `.use()` middleware.
|
|
23
|
+
- 🔐 **Secure**: Integrated JWT authentication and multi-language validation.
|
|
24
|
+
- 📁 **Uploads**: Easy file handling with Multer-based helpers.
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
## 🛠️ Quick Start / Inicio Rápido
|
|
29
|
+
|
|
30
|
+
### 1. Installation / Instalación
|
|
31
|
+
```bash
|
|
32
|
+
npm install @seip/blue-bird
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### 2. Initialize / Inicializar
|
|
36
|
+
```bash
|
|
37
|
+
npx blue-bird
|
|
38
|
+
```
|
|
39
|
+
*This copies the base structure: `backend`, `frontend`, and `.env`.*
|
|
40
|
+
*Esto copia la estructura base: `backend`, `frontend` y `.env`.*
|
|
41
|
+
|
|
42
|
+
### 3. Setup React
|
|
43
|
+
```bash
|
|
44
|
+
npm run react
|
|
45
|
+
```
|
|
46
|
+
*Configures React, React Router, and Vite automatically.*
|
|
47
|
+
*Configura React, React Router y Vite automáticamente.*
|
|
48
|
+
|
|
49
|
+
### 4. Development / Desarrollo
|
|
50
|
+
```bash
|
|
51
|
+
# Start Backend (Express)
|
|
52
|
+
npm run dev
|
|
53
|
+
|
|
54
|
+
# Start Frontend (Vite)
|
|
55
|
+
npm run vite:dev
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
<hr />
|
|
59
|
+
|
|
60
|
+
## 📖 Documentation / Documentación
|
|
61
|
+
|
|
62
|
+
Check out our full documentation for detailed API reference and examples:
|
|
63
|
+
|
|
64
|
+
- 🇺🇸 [English Documentation](https://seip25.github.io/Blue-bird/en.html)
|
|
65
|
+
- 🇪🇸 [Documentación en Español](https://seip25.github.io/Blue-bird/index.html)
|
|
66
|
+
|
|
67
|
+
<hr />
|
|
68
|
+
|
|
69
|
+
## 📄 License / Licencia
|
|
70
|
+
|
|
71
|
+
Distributed under the **MIT License**. See `LICENSE` for more information.
|
|
72
|
+
|
|
73
|
+
Distribuido bajo la **Licencia MIT**. Mira `LICENSE` para más información.
|
|
74
|
+
|
|
75
|
+
<hr />
|
|
76
|
+
|
|
77
|
+
<div align="center">
|
|
78
|
+
<p>Made with ❤️ by <strong>Seip25</strong></p>
|
|
79
|
+
</div>
|
package/backend/index.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import App from "../core/app.js";
|
|
2
|
+
import routerApiExample from "./routes/api.js";
|
|
3
|
+
import routerFrontendExample from "./routes/frontend.js";
|
|
4
|
+
|
|
5
|
+
const app = new App({
|
|
6
|
+
routes: [routerApiExample, routerFrontendExample],
|
|
7
|
+
cors: [],
|
|
8
|
+
middlewares: [],
|
|
9
|
+
host: "http://localhost",
|
|
10
|
+
port: process.env.PORT,
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
app.run();
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import Router from "../../core/router.js";
|
|
2
|
+
import Validator from "../../core/validate.js";
|
|
3
|
+
|
|
4
|
+
const routerApiExample = new Router("/api");
|
|
5
|
+
|
|
6
|
+
routerApiExample.get("/users", (req, res) => {
|
|
7
|
+
const users = [
|
|
8
|
+
{
|
|
9
|
+
name: "John Doe",
|
|
10
|
+
email: "john.doe@example.com",
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
name: "Jane Doe2",
|
|
14
|
+
email: "jane.doe2@example.com",
|
|
15
|
+
},
|
|
16
|
+
];
|
|
17
|
+
res.json(users);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const loginSchema = {
|
|
21
|
+
email: { required: true, email: true },
|
|
22
|
+
password: { required: true, min: 6 },
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const loginValidator = new Validator(loginSchema);
|
|
26
|
+
|
|
27
|
+
routerApiExample.post("/login", loginValidator.middleware(), (req, res) => {
|
|
28
|
+
res.json({ message: "Login successful", body: req.body });
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export default routerApiExample;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import Router from "../../core/router.js";
|
|
2
|
+
import Template from "../../core/template.js";
|
|
3
|
+
import App from "../../core/app.js";
|
|
4
|
+
import seoData from "./seo.js";
|
|
5
|
+
|
|
6
|
+
const routerFrontendExample = new Router();
|
|
7
|
+
routerFrontendExample.use(App.helmet()); // Helmet for frontend router
|
|
8
|
+
|
|
9
|
+
routerFrontendExample.get("/landing", (req, res) => {
|
|
10
|
+
return Template.renderHtml(res, "landing", {
|
|
11
|
+
metaTags:{
|
|
12
|
+
titleMeta:"Landing Example",
|
|
13
|
+
descriptionMeta: "Description meta",
|
|
14
|
+
keywordsMeta: "keywordsMeta"
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
routerFrontendExample.seo(
|
|
20
|
+
[
|
|
21
|
+
{
|
|
22
|
+
path: "/",
|
|
23
|
+
component: "Home",
|
|
24
|
+
seoKey: "home",
|
|
25
|
+
props: { id: 1, name: "Name" },
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
path: "/about",
|
|
29
|
+
component: "About",
|
|
30
|
+
seoKey: "about",
|
|
31
|
+
props: { id: 2, name: "Name 2" },
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
{ languages: ["en", "es"], defaultLanguage: "en", seoData },
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
routerFrontendExample.get("*", (req, res) => {
|
|
38
|
+
return Template.renderReact(res, "App");
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
export default routerFrontendExample;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SEO Data File
|
|
3
|
+
* Define multilingual SEO metadata for each route.
|
|
4
|
+
* Used with router.seo() via the seoData option.
|
|
5
|
+
*
|
|
6
|
+
* Structure: { seoKey: { lang: { titleMeta, descriptionMeta, keywordsMeta } } }
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* import seoData from "./seo.js";
|
|
10
|
+
* router.seo([
|
|
11
|
+
* { path: "/", component: "Home", seoKey: "home" }
|
|
12
|
+
* ], { languages: ["en", "es"], defaultLanguage: "en", seoData });
|
|
13
|
+
*/
|
|
14
|
+
export default {
|
|
15
|
+
home: {
|
|
16
|
+
en: {
|
|
17
|
+
titleMeta: "Home - Blue Bird",
|
|
18
|
+
descriptionMeta: "Welcome to Blue Bird Framework",
|
|
19
|
+
keywordsMeta: "blue bird, framework, express, react",
|
|
20
|
+
},
|
|
21
|
+
es: {
|
|
22
|
+
titleMeta: "Inicio - Blue Bird",
|
|
23
|
+
descriptionMeta: "Bienvenido al Framework Blue Bird",
|
|
24
|
+
keywordsMeta: "blue bird, framework, express, react",
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
about: {
|
|
28
|
+
en: {
|
|
29
|
+
titleMeta: "About - Blue Bird",
|
|
30
|
+
descriptionMeta: "About Blue Bird Framework",
|
|
31
|
+
keywordsMeta: "about, blue bird, framework",
|
|
32
|
+
},
|
|
33
|
+
es: {
|
|
34
|
+
titleMeta: "Acerca - Blue Bird",
|
|
35
|
+
descriptionMeta: "Acerca del Framework Blue Bird",
|
|
36
|
+
keywordsMeta: "acerca, blue bird, framework",
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
};
|