org-core-js 0.0.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/README.md +446 -0
- package/babel.config.json +13 -0
- package/cjs/core/driverCore.js +37 -0
- package/cjs/core/drivers/bull.js +56 -0
- package/cjs/core/drivers/fogu.js +14 -0
- package/cjs/core/drivers/mq.js +50 -0
- package/cjs/core/drivers/nats.js +161 -0
- package/cjs/core/drivers/osone.js +14 -0
- package/cjs/core/drivers/rabbitmq.js +68 -0
- package/cjs/core/drivers/redis.js +68 -0
- package/cjs/core/drivers/socket.js +36 -0
- package/cjs/core/entityCore.js +22 -0
- package/cjs/core/eventCore.js +26 -0
- package/cjs/core/index.js +477 -0
- package/cjs/core/libCore.js +22 -0
- package/cjs/core/repositoryCore.js +30 -0
- package/cjs/core/serverCore.js +142 -0
- package/cjs/core/serviceCore.js +26 -0
- package/cjs/core/utilCore.js +22 -0
- package/cjs/core/workerCore.js +27 -0
- package/cjs/fileCore.js +27 -0
- package/cjs/forawait.js +55 -0
- package/cjs/index.js +117 -0
- package/cjs/package.json +3 -0
- package/esm/core/driverCore.js +33 -0
- package/esm/core/drivers/bull.js +49 -0
- package/esm/core/drivers/fogu.js +12 -0
- package/esm/core/drivers/nats.js +160 -0
- package/esm/core/drivers/rabbitmq.js +64 -0
- package/esm/core/drivers/redis.js +71 -0
- package/esm/core/drivers/socket.js +28 -0
- package/esm/core/entityCore.js +12 -0
- package/esm/core/eventCore.js +17 -0
- package/esm/core/index.js +440 -0
- package/esm/core/libCore.js +13 -0
- package/esm/core/repositoryCore.js +25 -0
- package/esm/core/serverCore.js +155 -0
- package/esm/core/serviceCore.js +17 -0
- package/esm/core/utilCore.js +12 -0
- package/esm/core/workerCore.js +20 -0
- package/esm/fileCore.js +19 -0
- package/esm/forawait.js +48 -0
- package/esm/index.js +128 -0
- package/esm/package.json +3 -0
- package/lib/index.html +1021 -0
- package/package.json +73 -0
- package/src/app/events/test/app.js +13 -0
- package/src/app/events/test/ws.js +14 -0
- package/src/app/services/test/app.js +14 -0
- package/src/app/services/test/app1.js +11 -0
- package/src/core/entities/user.js +14 -0
- package/src/core/libs/hash.js +10 -0
- package/src/core/utils/auth.js +19 -0
- package/src/index.js +11 -0
- package/src/infra/db/index.js +7 -0
- package/src/infra/repositories/test/app.js +6 -0
- package/src/infra/web/http.js +15 -0
- package/src/infra/web/routers/auth.js +30 -0
- package/src/infra/web/routers/test.js +26 -0
- package/src/infra/web/ws/test.js +35 -0
- package/src/infra/workers/test/test.md +14 -0
- package/src/start.js +39 -0
- package/test/core.test.js +46 -0
package/lib/index.html
ADDED
|
@@ -0,0 +1,1021 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="pt-BR" class="dark">
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="UTF-8">
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
|
+
<title>create-org-app | Framework Modular para Aplicações Escaláveis</title>
|
|
8
|
+
<script src="https://cdn.tailwindcss.com"></script>
|
|
9
|
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
|
10
|
+
<script>
|
|
11
|
+
tailwind.config = {
|
|
12
|
+
darkMode: 'class',
|
|
13
|
+
theme: {
|
|
14
|
+
extend: {
|
|
15
|
+
colors: {
|
|
16
|
+
primary: {
|
|
17
|
+
50: '#f0f9ff',
|
|
18
|
+
100: '#e0f2fe',
|
|
19
|
+
200: '#bae6fd',
|
|
20
|
+
300: '#7dd3fc',
|
|
21
|
+
400: '#38bdf8',
|
|
22
|
+
500: '#0ea5e9',
|
|
23
|
+
600: '#0284c7',
|
|
24
|
+
700: '#0369a1',
|
|
25
|
+
800: '#075985',
|
|
26
|
+
900: '#0c4a6e',
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
fontFamily: {
|
|
30
|
+
'mono': ['JetBrains Mono', 'Fira Code', 'Monaco', 'Consolas', 'monospace']
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
</script>
|
|
36
|
+
<style>
|
|
37
|
+
.gradient-bg {
|
|
38
|
+
background: linear-gradient(135deg, #0c4a6e 0%, #075985 50%, #0369a1 100%);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.architecture-card {
|
|
42
|
+
background: linear-gradient(135deg, #1e293b, #0f172a);
|
|
43
|
+
border: 1px solid #334155;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.code-block {
|
|
47
|
+
background-color: #1e293b;
|
|
48
|
+
border-left: 4px solid #0ea5e9;
|
|
49
|
+
font-family: 'JetBrains Mono', 'Fira Code', monospace;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.nav-link.active {
|
|
53
|
+
background-color: rgba(14, 165, 233, 0.1);
|
|
54
|
+
border-left: 3px solid #0ea5e9;
|
|
55
|
+
color: #38bdf8;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.fade-in {
|
|
59
|
+
animation: fadeIn 0.5s ease-in-out;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@keyframes fadeIn {
|
|
63
|
+
from {
|
|
64
|
+
opacity: 0;
|
|
65
|
+
transform: translateY(10px);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
to {
|
|
69
|
+
opacity: 1;
|
|
70
|
+
transform: translateY(0);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.method-badge {
|
|
75
|
+
background: linear-gradient(135deg, #0ea5e9, #38bdf8);
|
|
76
|
+
color: white;
|
|
77
|
+
padding: 0.25rem 0.75rem;
|
|
78
|
+
border-radius: 0.375rem;
|
|
79
|
+
font-size: 0.75rem;
|
|
80
|
+
font-weight: 600;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.lifecycle-flow {
|
|
84
|
+
background: linear-gradient(135deg, #1e293b, #334155);
|
|
85
|
+
border: 1px solid #475569;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.layer-badge {
|
|
89
|
+
background: linear-gradient(135deg, #7dd3fc, #38bdf8);
|
|
90
|
+
color: #0c4a6e;
|
|
91
|
+
padding: 0.25rem 0.75rem;
|
|
92
|
+
border-radius: 1rem;
|
|
93
|
+
font-size: 0.75rem;
|
|
94
|
+
font-weight: 600;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.driver-tag {
|
|
98
|
+
background: rgba(14, 165, 233, 0.2);
|
|
99
|
+
border: 1px solid #0ea5e9;
|
|
100
|
+
color: #7dd3fc;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.file-path {
|
|
104
|
+
background: rgba(100, 116, 139, 0.3);
|
|
105
|
+
border-radius: 0.25rem;
|
|
106
|
+
padding: 0.125rem 0.5rem;
|
|
107
|
+
font-size: 0.875rem;
|
|
108
|
+
font-family: 'JetBrains Mono', monospace;
|
|
109
|
+
}
|
|
110
|
+
</style>
|
|
111
|
+
</head>
|
|
112
|
+
|
|
113
|
+
<body class="bg-gray-900 text-gray-200 font-sans">
|
|
114
|
+
<!-- Header -->
|
|
115
|
+
<header class="gradient-bg text-white sticky top-0 z-10 shadow-lg">
|
|
116
|
+
<div class="container mx-auto px-4 py-4 flex justify-between items-center">
|
|
117
|
+
<div class="flex items-center space-x-3">
|
|
118
|
+
<div class="bg-primary-500 p-2 rounded-lg shadow-lg">
|
|
119
|
+
<i class="fas fa-cube text-white text-xl"></i>
|
|
120
|
+
</div>
|
|
121
|
+
<div>
|
|
122
|
+
<h1 class="text-2xl font-bold">create-org-app</h1>
|
|
123
|
+
<p class="text-primary-200 text-sm">Framework Modular e Orientado a Eventos</p>
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
|
|
127
|
+
<div class="flex items-center space-x-4">
|
|
128
|
+
<button id="theme-toggle"
|
|
129
|
+
class="p-2 rounded-full bg-primary-800 hover:bg-primary-700 transition-colors duration-200">
|
|
130
|
+
<i class="fas fa-moon"></i>
|
|
131
|
+
</button>
|
|
132
|
+
<a href="https://github.com/org/create-org-app"
|
|
133
|
+
class="bg-primary-700 hover:bg-primary-600 px-4 py-2 rounded-lg transition-colors duration-200 flex items-center space-x-2 shadow-lg">
|
|
134
|
+
<i class="fab fa-github"></i>
|
|
135
|
+
<span>GitHub</span>
|
|
136
|
+
</a>
|
|
137
|
+
</div>
|
|
138
|
+
</div>
|
|
139
|
+
</header>
|
|
140
|
+
|
|
141
|
+
<div class="container mx-auto px-4 py-8 flex flex-col lg:flex-row">
|
|
142
|
+
<!-- Sidebar Navigation -->
|
|
143
|
+
<aside class="lg:w-1/4 lg:pr-8 mb-8 lg:mb-0 lg:sticky lg:top-24 self-start">
|
|
144
|
+
<nav class="architecture-card rounded-xl p-6 shadow-lg">
|
|
145
|
+
<h3 class="font-bold text-lg mb-4 text-primary-300 flex items-center">
|
|
146
|
+
<i class="fas fa-bookmark mr-2"></i>
|
|
147
|
+
Documentação
|
|
148
|
+
</h3>
|
|
149
|
+
<ul class="space-y-2">
|
|
150
|
+
<li>
|
|
151
|
+
<a href="#overview"
|
|
152
|
+
class="nav-link block py-2 px-4 rounded-lg hover:bg-gray-700 transition-colors duration-200 flex items-center space-x-2">
|
|
153
|
+
<i class="fas fa-rocket text-primary-400 w-5"></i>
|
|
154
|
+
<span>Visão Geral</span>
|
|
155
|
+
</a>
|
|
156
|
+
</li>
|
|
157
|
+
<li>
|
|
158
|
+
<a href="#installation"
|
|
159
|
+
class="nav-link block py-2 px-4 rounded-lg hover:bg-gray-700 transition-colors duration-200 flex items-center space-x-2">
|
|
160
|
+
<i class="fas fa-download text-primary-400 w-5"></i>
|
|
161
|
+
<span>Instalação</span>
|
|
162
|
+
</a>
|
|
163
|
+
</li>
|
|
164
|
+
<li>
|
|
165
|
+
<a href="#structure"
|
|
166
|
+
class="nav-link block py-2 px-4 rounded-lg hover:bg-gray-700 transition-colors duration-200 flex items-center space-x-2">
|
|
167
|
+
<i class="fas fa-folder text-primary-400 w-5"></i>
|
|
168
|
+
<span>Estrutura</span>
|
|
169
|
+
</a>
|
|
170
|
+
</li>
|
|
171
|
+
<li>
|
|
172
|
+
<a href="#lifecycle"
|
|
173
|
+
class="nav-link block py-2 px-4 rounded-lg hover:bg-gray-700 transition-colors duration-200 flex items-center space-x-2">
|
|
174
|
+
<i class="fas fa-sync text-primary-400 w-5"></i>
|
|
175
|
+
<span>Ciclo de Vida</span>
|
|
176
|
+
</a>
|
|
177
|
+
</li>
|
|
178
|
+
<li>
|
|
179
|
+
<a href="#events"
|
|
180
|
+
class="nav-link block py-2 px-4 rounded-lg hover:bg-gray-700 transition-colors duration-200 flex items-center space-x-2">
|
|
181
|
+
<i class="fas fa-bolt text-primary-400 w-5"></i>
|
|
182
|
+
<span>Eventos</span>
|
|
183
|
+
</a>
|
|
184
|
+
</li>
|
|
185
|
+
<li>
|
|
186
|
+
<a href="#services"
|
|
187
|
+
class="nav-link block py-2 px-4 rounded-lg hover:bg-gray-700 transition-colors duration-200 flex items-center space-x-2">
|
|
188
|
+
<i class="fas fa-cogs text-primary-400 w-5"></i>
|
|
189
|
+
<span>Serviços</span>
|
|
190
|
+
</a>
|
|
191
|
+
</li>
|
|
192
|
+
<li>
|
|
193
|
+
<a href="#core"
|
|
194
|
+
class="nav-link block py-2 px-4 rounded-lg hover:bg-gray-700 transition-colors duration-200 flex items-center space-x-2">
|
|
195
|
+
<i class="fas fa-gem text-primary-400 w-5"></i>
|
|
196
|
+
<span>Camada Core</span>
|
|
197
|
+
</a>
|
|
198
|
+
</li>
|
|
199
|
+
<li>
|
|
200
|
+
<a href="#infra"
|
|
201
|
+
class="nav-link block py-2 px-4 rounded-lg hover:bg-gray-700 transition-colors duration-200 flex items-center space-x-2">
|
|
202
|
+
<i class="fas fa-server text-primary-400 w-5"></i>
|
|
203
|
+
<span>Infraestrutura</span>
|
|
204
|
+
</a>
|
|
205
|
+
</li>
|
|
206
|
+
<li>
|
|
207
|
+
<a href="#testing"
|
|
208
|
+
class="nav-link block py-2 px-4 rounded-lg hover:bg-gray-700 transition-colors duration-200 flex items-center space-x-2">
|
|
209
|
+
<i class="fas fa-vial text-primary-400 w-5"></i>
|
|
210
|
+
<span>Testes</span>
|
|
211
|
+
</a>
|
|
212
|
+
</li>
|
|
213
|
+
<li>
|
|
214
|
+
<a href="#advanced"
|
|
215
|
+
class="nav-link block py-2 px-4 rounded-lg hover:bg-gray-700 transition-colors duration-200 flex items-center space-x-2">
|
|
216
|
+
<i class="fas fa-sliders-h text-primary-400 w-5"></i>
|
|
217
|
+
<span>Avançado</span>
|
|
218
|
+
</a>
|
|
219
|
+
</li>
|
|
220
|
+
</ul>
|
|
221
|
+
</nav>
|
|
222
|
+
</aside>
|
|
223
|
+
|
|
224
|
+
<!-- Main Content -->
|
|
225
|
+
<main class="lg:w-3/4 space-y-12">
|
|
226
|
+
<!-- Overview Section -->
|
|
227
|
+
<section id="overview" class="fade-in">
|
|
228
|
+
<div class="architecture-card rounded-xl p-6 shadow-lg">
|
|
229
|
+
<div class="flex items-center mb-6">
|
|
230
|
+
<div class="bg-primary-500 p-3 rounded-lg mr-4 shadow-lg">
|
|
231
|
+
<i class="fas fa-rocket text-white text-2xl"></i>
|
|
232
|
+
</div>
|
|
233
|
+
<div>
|
|
234
|
+
<h2 class="text-3xl font-bold">Visão Geral</h2>
|
|
235
|
+
<p class="text-primary-300 mt-1">Framework modular e orientado a eventos</p>
|
|
236
|
+
</div>
|
|
237
|
+
</div>
|
|
238
|
+
|
|
239
|
+
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
|
|
240
|
+
<div>
|
|
241
|
+
<p class="text-lg mb-4">
|
|
242
|
+
O <span class="text-primary-300 font-semibold">create-org-app</span> é um <em>framework
|
|
243
|
+
modular e orientado a eventos</em> para construção de aplicações escaláveis,
|
|
244
|
+
distribuídas e multi-driver.
|
|
245
|
+
</p>
|
|
246
|
+
|
|
247
|
+
<p class="text-lg mb-4">
|
|
248
|
+
Suporta <strong>HTTP</strong>, <strong>WebSocket</strong>, <strong>NATS</strong>,
|
|
249
|
+
<strong>Redis</strong>, <strong>BullMQ</strong>, <strong>gRPC</strong> e muito mais —
|
|
250
|
+
oferecendo um ecossistema completo para desenvolvimento de
|
|
251
|
+
<strong>microserviços</strong>, <strong>SaaS</strong>, <strong>sistemas
|
|
252
|
+
reativos</strong> e <strong>plataformas de automação</strong>.
|
|
253
|
+
</p>
|
|
254
|
+
</div>
|
|
255
|
+
|
|
256
|
+
<div class="bg-primary-900/30 p-4 rounded-lg border border-primary-700">
|
|
257
|
+
<h4 class="font-bold text-primary-300 mb-3 flex items-center">
|
|
258
|
+
<i class="fas fa-lightbulb mr-2"></i>
|
|
259
|
+
O que a biblioteca fornece
|
|
260
|
+
</h4>
|
|
261
|
+
<div class="grid grid-cols-1 gap-2 text-sm">
|
|
262
|
+
<div class="flex items-start">
|
|
263
|
+
<i class="fas fa-check text-primary-400 mt-1 mr-2"></i>
|
|
264
|
+
<span><strong>Serviços</strong> (<code class="file-path">app/services</code>)</span>
|
|
265
|
+
</div>
|
|
266
|
+
<div class="flex items-start">
|
|
267
|
+
<i class="fas fa-check text-primary-400 mt-1 mr-2"></i>
|
|
268
|
+
<span><strong>Eventos</strong> (<code class="file-path">app/events</code>)</span>
|
|
269
|
+
</div>
|
|
270
|
+
<div class="flex items-start">
|
|
271
|
+
<i class="fas fa-check text-primary-400 mt-1 mr-2"></i>
|
|
272
|
+
<span><strong>Entidades e DTOs</strong> (<code
|
|
273
|
+
class="file-path">core/entities</code>)</span>
|
|
274
|
+
</div>
|
|
275
|
+
<div class="flex items-start">
|
|
276
|
+
<i class="fas fa-check text-primary-400 mt-1 mr-2"></i>
|
|
277
|
+
<span><strong>Bibliotecas internas</strong> (<code
|
|
278
|
+
class="file-path">core/libs</code>)</span>
|
|
279
|
+
</div>
|
|
280
|
+
<div class="flex items-start">
|
|
281
|
+
<i class="fas fa-check text-primary-400 mt-1 mr-2"></i>
|
|
282
|
+
<span><strong>Utilitários globais</strong> (<code
|
|
283
|
+
class="file-path">core/utils</code>)</span>
|
|
284
|
+
</div>
|
|
285
|
+
<div class="flex items-start">
|
|
286
|
+
<i class="fas fa-check text-primary-400 mt-1 mr-2"></i>
|
|
287
|
+
<span><strong>Infraestrutura completa</strong> (<code
|
|
288
|
+
class="file-path">infra/*</code>)</span>
|
|
289
|
+
</div>
|
|
290
|
+
</div>
|
|
291
|
+
</div>
|
|
292
|
+
</div>
|
|
293
|
+
|
|
294
|
+
<div class="mt-6 flex flex-wrap gap-2">
|
|
295
|
+
<span class="driver-tag px-3 py-1 rounded-full text-sm">HTTP</span>
|
|
296
|
+
<span class="driver-tag px-3 py-1 rounded-full text-sm">WebSocket</span>
|
|
297
|
+
<span class="driver-tag px-3 py-1 rounded-full text-sm">NATS</span>
|
|
298
|
+
<span class="driver-tag px-3 py-1 rounded-full text-sm">Redis</span>
|
|
299
|
+
<span class="driver-tag px-3 py-1 rounded-full text-sm">BullMQ</span>
|
|
300
|
+
<span class="driver-tag px-3 py-1 rounded-full text-sm">gRPC</span>
|
|
301
|
+
</div>
|
|
302
|
+
</div>
|
|
303
|
+
</section>
|
|
304
|
+
|
|
305
|
+
<!-- Installation Section -->
|
|
306
|
+
<section id="installation" class="fade-in">
|
|
307
|
+
<div class="architecture-card rounded-xl p-6 shadow-lg">
|
|
308
|
+
<div class="flex items-center mb-6">
|
|
309
|
+
<div class="bg-primary-500 p-3 rounded-lg mr-4 shadow-lg">
|
|
310
|
+
<i class="fas fa-download text-white text-2xl"></i>
|
|
311
|
+
</div>
|
|
312
|
+
<h2 class="text-3xl font-bold">Instalação</h2>
|
|
313
|
+
</div>
|
|
314
|
+
|
|
315
|
+
<div class="code-block p-4 rounded-lg mb-6">
|
|
316
|
+
<pre class="text-green-400 font-mono"><code>npm install create-org-app</code></pre>
|
|
317
|
+
</div>
|
|
318
|
+
|
|
319
|
+
<p class="mb-4">Ou se preferires usar Yarn:</p>
|
|
320
|
+
|
|
321
|
+
<div class="code-block p-4 rounded-lg">
|
|
322
|
+
<pre class="text-green-400 font-mono"><code>yarn add create-org-app</code></pre>
|
|
323
|
+
</div>
|
|
324
|
+
</div>
|
|
325
|
+
</section>
|
|
326
|
+
|
|
327
|
+
<!-- Structure Section -->
|
|
328
|
+
<section id="structure" class="fade-in">
|
|
329
|
+
<div class="architecture-card rounded-xl p-6 shadow-lg">
|
|
330
|
+
<div class="flex items-center mb-6">
|
|
331
|
+
<div class="bg-primary-500 p-3 rounded-lg mr-4 shadow-lg">
|
|
332
|
+
<i class="fas fa-folder text-white text-2xl"></i>
|
|
333
|
+
</div>
|
|
334
|
+
<h2 class="text-3xl font-bold">Estrutura Geral</h2>
|
|
335
|
+
</div>
|
|
336
|
+
|
|
337
|
+
<div class="bg-gray-800 p-4 rounded-lg mb-6 font-mono text-sm">
|
|
338
|
+
<pre class="text-gray-200 overflow-x-auto">
|
|
339
|
+
src/
|
|
340
|
+
├── app/
|
|
341
|
+
│ ├── services/
|
|
342
|
+
│ │ └── test/app.js
|
|
343
|
+
│ └── events/
|
|
344
|
+
│ └── test/app.js
|
|
345
|
+
│
|
|
346
|
+
├── core/
|
|
347
|
+
│ ├── entities/
|
|
348
|
+
│ │ └── user.js
|
|
349
|
+
│ ├── libs/
|
|
350
|
+
│ │ └── password.js
|
|
351
|
+
│ └── utils/
|
|
352
|
+
│ └── auth.js
|
|
353
|
+
│
|
|
354
|
+
├── infra/
|
|
355
|
+
│ ├── db/
|
|
356
|
+
│ │ └── index.js
|
|
357
|
+
│ ├── repositories/
|
|
358
|
+
│ │ └── test/app.js
|
|
359
|
+
│ ├── web/
|
|
360
|
+
│ │ ├── http.js
|
|
361
|
+
│ │ ├── routers/
|
|
362
|
+
│ │ │ └── test.js
|
|
363
|
+
│ │ └── ws/
|
|
364
|
+
│ │ └── test.js
|
|
365
|
+
│ └── workers/
|
|
366
|
+
│ └── worker.js
|
|
367
|
+
│
|
|
368
|
+
├── start.js
|
|
369
|
+
└── index.js
|
|
370
|
+
</pre>
|
|
371
|
+
</div>
|
|
372
|
+
|
|
373
|
+
<div class="grid grid-cols-1 md:grid-cols-3 gap-4 text-center">
|
|
374
|
+
<div class="p-4 bg-gray-800 rounded-lg">
|
|
375
|
+
<div class="layer-badge inline-block mb-2">APP</div>
|
|
376
|
+
<p class="text-sm text-gray-300">Serviços e Eventos</p>
|
|
377
|
+
</div>
|
|
378
|
+
<div class="p-4 bg-gray-800 rounded-lg">
|
|
379
|
+
<div class="layer-badge inline-block mb-2">CORE</div>
|
|
380
|
+
<p class="text-sm text-gray-300">Entidades, Libs, Utils</p>
|
|
381
|
+
</div>
|
|
382
|
+
<div class="p-4 bg-gray-800 rounded-lg">
|
|
383
|
+
<div class="layer-badge inline-block mb-2">INFRA</div>
|
|
384
|
+
<p class="text-sm text-gray-300">DB, Web, Workers</p>
|
|
385
|
+
</div>
|
|
386
|
+
</div>
|
|
387
|
+
</div>
|
|
388
|
+
</section>
|
|
389
|
+
|
|
390
|
+
<!-- Lifecycle Section -->
|
|
391
|
+
<section id="lifecycle" class="fade-in">
|
|
392
|
+
<div class="architecture-card rounded-xl p-6 shadow-lg">
|
|
393
|
+
<div class="flex items-center mb-6">
|
|
394
|
+
<div class="bg-primary-500 p-3 rounded-lg mr-4 shadow-lg">
|
|
395
|
+
<i class="fas fa-sync text-white text-2xl"></i>
|
|
396
|
+
</div>
|
|
397
|
+
<h2 class="text-3xl font-bold">Ciclo de Vida da Aplicação</h2>
|
|
398
|
+
</div>
|
|
399
|
+
|
|
400
|
+
<h3 class="text-xl font-bold mb-4 text-primary-300">index.js</h3>
|
|
401
|
+
|
|
402
|
+
<div class="code-block p-4 rounded-lg mb-6">
|
|
403
|
+
<pre class="text-gray-200 overflow-x-auto font-mono text-sm">
|
|
404
|
+
export default {
|
|
405
|
+
async bootstrap({ core }) {
|
|
406
|
+
core.service("test.app").execute({});
|
|
407
|
+
/*
|
|
408
|
+
core.driver("nats").command("test.app1", { name: "ssssss" }, {
|
|
409
|
+
apiKey: "sssss"
|
|
410
|
+
});
|
|
411
|
+
*/
|
|
412
|
+
},
|
|
413
|
+
|
|
414
|
+
async distroy(core) {
|
|
415
|
+
console.log("close", e);
|
|
416
|
+
}
|
|
417
|
+
};
|
|
418
|
+
</pre>
|
|
419
|
+
</div>
|
|
420
|
+
|
|
421
|
+
<div class="overflow-x-auto mb-8">
|
|
422
|
+
<table class="min-w-full bg-gray-800 rounded-lg overflow-hidden">
|
|
423
|
+
<thead class="bg-gray-700">
|
|
424
|
+
<tr>
|
|
425
|
+
<th class="py-3 px-4 text-left">Método</th>
|
|
426
|
+
<th class="py-3 px-4 text-left">Momento</th>
|
|
427
|
+
<th class="py-3 px-4 text-left">Descrição</th>
|
|
428
|
+
</tr>
|
|
429
|
+
</thead>
|
|
430
|
+
<tbody>
|
|
431
|
+
<tr class="border-b border-gray-700">
|
|
432
|
+
<td class="py-3 px-4 font-semibold text-primary-300">bootstrap({ core })</td>
|
|
433
|
+
<td class="py-3 px-4"><span class="method-badge">Startup</span></td>
|
|
434
|
+
<td class="py-3 px-4">Executado na inicialização. Ideal para pré-carregar serviços,
|
|
435
|
+
listeners e integrações.</td>
|
|
436
|
+
</tr>
|
|
437
|
+
<tr>
|
|
438
|
+
<td class="py-3 px-4 font-semibold text-primary-300">distroy(core)</td>
|
|
439
|
+
<td class="py-3 px-4"><span class="method-badge">Shutdown</span></td>
|
|
440
|
+
<td class="py-3 px-4">Executado no encerramento da aplicação, para limpar conexões e
|
|
441
|
+
recursos.</td>
|
|
442
|
+
</tr>
|
|
443
|
+
</tbody>
|
|
444
|
+
</table>
|
|
445
|
+
</div>
|
|
446
|
+
|
|
447
|
+
<h3 class="text-xl font-bold mb-4 text-primary-300">start.js</h3>
|
|
448
|
+
|
|
449
|
+
<div class="code-block p-4 rounded-lg">
|
|
450
|
+
<pre class="text-gray-200 overflow-x-auto font-mono text-sm">
|
|
451
|
+
import { app } from "../esm/index.js";
|
|
452
|
+
// import { app } from "create-org-app";
|
|
453
|
+
|
|
454
|
+
await app.run({
|
|
455
|
+
drivers: [
|
|
456
|
+
/* { type: "nats", name: "nats", config: { servers: process.env.NATS_URL } }, */
|
|
457
|
+
],
|
|
458
|
+
servers: [
|
|
459
|
+
{ type: "http", rootPath: "" },
|
|
460
|
+
/* { type: "nats", driver: "nats", services: ["test.*"] } */
|
|
461
|
+
]
|
|
462
|
+
});
|
|
463
|
+
</pre>
|
|
464
|
+
</div>
|
|
465
|
+
</div>
|
|
466
|
+
</section>
|
|
467
|
+
|
|
468
|
+
<!-- Events Section -->
|
|
469
|
+
<section id="events" class="fade-in">
|
|
470
|
+
<div class="architecture-card rounded-xl p-6 shadow-lg">
|
|
471
|
+
<div class="flex items-center mb-6">
|
|
472
|
+
<div class="bg-primary-500 p-3 rounded-lg mr-4 shadow-lg">
|
|
473
|
+
<i class="fas fa-bolt text-white text-2xl"></i>
|
|
474
|
+
</div>
|
|
475
|
+
<h2 class="text-3xl font-bold">Eventos</h2>
|
|
476
|
+
</div>
|
|
477
|
+
|
|
478
|
+
<div class="space-y-8">
|
|
479
|
+
<div>
|
|
480
|
+
<h3 class="text-xl font-bold mb-4 text-primary-300">Evento Interno (Node)</h3>
|
|
481
|
+
<div class="code-block p-4 rounded-lg">
|
|
482
|
+
<pre class="text-gray-200 overflow-x-auto font-mono text-sm">
|
|
483
|
+
// Evento interno (Node)
|
|
484
|
+
export default () => ({
|
|
485
|
+
event: {
|
|
486
|
+
method: "node"
|
|
487
|
+
},
|
|
488
|
+
execute: (data) => {
|
|
489
|
+
console.log(data, "event");
|
|
490
|
+
}
|
|
491
|
+
});
|
|
492
|
+
</pre>
|
|
493
|
+
</div>
|
|
494
|
+
</div>
|
|
495
|
+
|
|
496
|
+
<div>
|
|
497
|
+
<h3 class="text-xl font-bold mb-4 text-primary-300">Evento WebSocket</h3>
|
|
498
|
+
<div class="code-block p-4 rounded-lg">
|
|
499
|
+
<pre class="text-gray-200 overflow-x-auto font-mono text-sm">
|
|
500
|
+
// Evento WebSocket
|
|
501
|
+
export default () => ({
|
|
502
|
+
event: {
|
|
503
|
+
method: "ws",
|
|
504
|
+
route: "/test",
|
|
505
|
+
topic: "test.app"
|
|
506
|
+
},
|
|
507
|
+
execute: (data) => {
|
|
508
|
+
console.log(data, "event");
|
|
509
|
+
}
|
|
510
|
+
});
|
|
511
|
+
</pre>
|
|
512
|
+
</div>
|
|
513
|
+
</div>
|
|
514
|
+
</div>
|
|
515
|
+
</div>
|
|
516
|
+
</section>
|
|
517
|
+
|
|
518
|
+
<!-- Services Section -->
|
|
519
|
+
<section id="services" class="fade-in">
|
|
520
|
+
<div class="architecture-card rounded-xl p-6 shadow-lg">
|
|
521
|
+
<div class="flex items-center mb-6">
|
|
522
|
+
<div class="bg-primary-500 p-3 rounded-lg mr-4 shadow-lg">
|
|
523
|
+
<i class="fas fa-cogs text-white text-2xl"></i>
|
|
524
|
+
</div>
|
|
525
|
+
<h2 class="text-3xl font-bold">Serviços</h2>
|
|
526
|
+
</div>
|
|
527
|
+
|
|
528
|
+
<div class="code-block p-4 rounded-lg">
|
|
529
|
+
<pre class="text-gray-200 overflow-x-auto font-mono text-sm">
|
|
530
|
+
export default ({ entity, repository }) => ({
|
|
531
|
+
driver: {
|
|
532
|
+
node: true
|
|
533
|
+
},
|
|
534
|
+
async execute(data) {
|
|
535
|
+
console.log(data);
|
|
536
|
+
const app = await entity("user").entity(data);
|
|
537
|
+
const res = await repository("test.app").execute(app.id || "ddddddddddd");
|
|
538
|
+
return { data: res };
|
|
539
|
+
}
|
|
540
|
+
});
|
|
541
|
+
</pre>
|
|
542
|
+
</div>
|
|
543
|
+
</div>
|
|
544
|
+
</section>
|
|
545
|
+
|
|
546
|
+
<!-- Core Layer Section -->
|
|
547
|
+
<section id="core" class="fade-in">
|
|
548
|
+
<div class="architecture-card rounded-xl p-6 shadow-lg">
|
|
549
|
+
<div class="flex items-center mb-6">
|
|
550
|
+
<div class="bg-primary-500 p-3 rounded-lg mr-4 shadow-lg">
|
|
551
|
+
<i class="fas fa-gem text-white text-2xl"></i>
|
|
552
|
+
</div>
|
|
553
|
+
<h2 class="text-3xl font-bold">Camada Core</h2>
|
|
554
|
+
</div>
|
|
555
|
+
|
|
556
|
+
<div class="space-y-8">
|
|
557
|
+
<div>
|
|
558
|
+
<h3 class="text-xl font-bold mb-4 text-primary-300">Entidades</h3>
|
|
559
|
+
<div class="code-block p-4 rounded-lg">
|
|
560
|
+
<pre class="text-gray-200 overflow-x-auto font-mono text-sm">
|
|
561
|
+
import { z } from "zod";
|
|
562
|
+
|
|
563
|
+
export default () => ({
|
|
564
|
+
entity(data) {
|
|
565
|
+
const schema = z.object({
|
|
566
|
+
id: z.string().optional(),
|
|
567
|
+
name: z.string().min(2)
|
|
568
|
+
});
|
|
569
|
+
return schema.parse(data);
|
|
570
|
+
},
|
|
571
|
+
dto() {
|
|
572
|
+
return { name: "sss" };
|
|
573
|
+
}
|
|
574
|
+
});
|
|
575
|
+
</pre>
|
|
576
|
+
</div>
|
|
577
|
+
</div>
|
|
578
|
+
|
|
579
|
+
<div>
|
|
580
|
+
<h3 class="text-xl font-bold mb-4 text-primary-300">Bibliotecas</h3>
|
|
581
|
+
<div class="code-block p-4 rounded-lg">
|
|
582
|
+
<pre class="text-gray-200 overflow-x-auto font-mono text-sm">
|
|
583
|
+
export default () => ({
|
|
584
|
+
password(text) {
|
|
585
|
+
return text;
|
|
586
|
+
},
|
|
587
|
+
compare(password, hash) {
|
|
588
|
+
return password === hash;
|
|
589
|
+
}
|
|
590
|
+
});
|
|
591
|
+
</pre>
|
|
592
|
+
</div>
|
|
593
|
+
</div>
|
|
594
|
+
|
|
595
|
+
<div>
|
|
596
|
+
<h3 class="text-xl font-bold mb-4 text-primary-300">Utilitários</h3>
|
|
597
|
+
<div class="code-block p-4 rounded-lg">
|
|
598
|
+
<pre class="text-gray-200 overflow-x-auto font-mono text-sm">
|
|
599
|
+
export default () => ({
|
|
600
|
+
apiKey(headers) {
|
|
601
|
+
console.log(headers);
|
|
602
|
+
return false;
|
|
603
|
+
}
|
|
604
|
+
});
|
|
605
|
+
</pre>
|
|
606
|
+
</div>
|
|
607
|
+
</div>
|
|
608
|
+
</div>
|
|
609
|
+
</div>
|
|
610
|
+
</section>
|
|
611
|
+
|
|
612
|
+
<!-- Infrastructure Section -->
|
|
613
|
+
<section id="infra" class="fade-in">
|
|
614
|
+
<div class="architecture-card rounded-xl p-6 shadow-lg">
|
|
615
|
+
<div class="flex items-center mb-6">
|
|
616
|
+
<div class="bg-primary-500 p-3 rounded-lg mr-4 shadow-lg">
|
|
617
|
+
<i class="fas fa-server text-white text-2xl"></i>
|
|
618
|
+
</div>
|
|
619
|
+
<h2 class="text-3xl font-bold">Infraestrutura</h2>
|
|
620
|
+
</div>
|
|
621
|
+
|
|
622
|
+
<div class="space-y-8">
|
|
623
|
+
<div>
|
|
624
|
+
<h3 class="text-xl font-bold mb-4 text-primary-300">Base de Dados</h3>
|
|
625
|
+
<div class="code-block p-4 rounded-lg">
|
|
626
|
+
<pre class="text-gray-200 overflow-x-auto font-mono text-sm">
|
|
627
|
+
export default () => ({
|
|
628
|
+
app: {
|
|
629
|
+
findUnique(id) {
|
|
630
|
+
return id;
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
});
|
|
634
|
+
</pre>
|
|
635
|
+
</div>
|
|
636
|
+
</div>
|
|
637
|
+
|
|
638
|
+
<div>
|
|
639
|
+
<h3 class="text-xl font-bold mb-4 text-primary-300">Repositório</h3>
|
|
640
|
+
<div class="code-block p-4 rounded-lg">
|
|
641
|
+
<pre class="text-gray-200 overflow-x-auto font-mono text-sm">
|
|
642
|
+
export default ({ db }) => ({
|
|
643
|
+
async execute(id) {
|
|
644
|
+
return await db.app.findUnique(id);
|
|
645
|
+
}
|
|
646
|
+
});
|
|
647
|
+
</pre>
|
|
648
|
+
</div>
|
|
649
|
+
</div>
|
|
650
|
+
|
|
651
|
+
<div>
|
|
652
|
+
<h3 class="text-xl font-bold mb-4 text-primary-300">HTTP - Routers</h3>
|
|
653
|
+
<div class="code-block p-4 rounded-lg">
|
|
654
|
+
<pre class="text-gray-200 overflow-x-auto font-mono text-sm">
|
|
655
|
+
export default ({ util }) => ([
|
|
656
|
+
{
|
|
657
|
+
url: "/api/test",
|
|
658
|
+
method: "get",
|
|
659
|
+
middlewares: [util("auth").apiKey([])],
|
|
660
|
+
async handler(request, reply) {
|
|
661
|
+
const { user } = request;
|
|
662
|
+
try {
|
|
663
|
+
reply.send({ data: user });
|
|
664
|
+
} catch (error) {
|
|
665
|
+
reply.status(500).send({ error: error.message });
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
]);
|
|
670
|
+
</pre>
|
|
671
|
+
</div>
|
|
672
|
+
</div>
|
|
673
|
+
|
|
674
|
+
<div>
|
|
675
|
+
<h3 class="text-xl font-bold mb-4 text-primary-300">WebSocket</h3>
|
|
676
|
+
<div class="code-block p-4 rounded-lg">
|
|
677
|
+
<pre class="text-gray-200 overflow-x-auto font-mono text-sm">
|
|
678
|
+
import forawait from "../../../../esm/forawait.js";
|
|
679
|
+
|
|
680
|
+
export default ({ events }) => ({
|
|
681
|
+
route: "/test",
|
|
682
|
+
|
|
683
|
+
async auth(socket, next) {
|
|
684
|
+
try {
|
|
685
|
+
next();
|
|
686
|
+
} catch (error) {
|
|
687
|
+
next(error);
|
|
688
|
+
}
|
|
689
|
+
},
|
|
690
|
+
|
|
691
|
+
async connection(socket) {
|
|
692
|
+
console.info("Socket connected!", socket.id);
|
|
693
|
+
socket.join("test");
|
|
694
|
+
|
|
695
|
+
forawait.generate(events, (io) => {
|
|
696
|
+
socket.on(io.event.topic, (input, cb) => {
|
|
697
|
+
io.execute({ input, cb }, { socket, io: this });
|
|
698
|
+
});
|
|
699
|
+
});
|
|
700
|
+
|
|
701
|
+
socket.on("disconnect", async () => {
|
|
702
|
+
console.log("disconnect:" + socket.id);
|
|
703
|
+
});
|
|
704
|
+
}
|
|
705
|
+
});
|
|
706
|
+
</pre>
|
|
707
|
+
</div>
|
|
708
|
+
</div>
|
|
709
|
+
|
|
710
|
+
<div>
|
|
711
|
+
<h3 class="text-xl font-bold mb-4 text-primary-300">Worker</h3>
|
|
712
|
+
<div class="code-block p-4 rounded-lg">
|
|
713
|
+
<pre class="text-gray-200 overflow-x-auto font-mono text-sm">
|
|
714
|
+
export default ({ service }) => ({
|
|
715
|
+
job: {
|
|
716
|
+
name: "test.app",
|
|
717
|
+
method: "node"
|
|
718
|
+
},
|
|
719
|
+
async execute({ data }) {
|
|
720
|
+
await service("test.app").execute(data);
|
|
721
|
+
return {};
|
|
722
|
+
}
|
|
723
|
+
});
|
|
724
|
+
</pre>
|
|
725
|
+
</div>
|
|
726
|
+
</div>
|
|
727
|
+
</div>
|
|
728
|
+
</div>
|
|
729
|
+
</section>
|
|
730
|
+
|
|
731
|
+
<!-- Testing Section -->
|
|
732
|
+
<section id="testing" class="fade-in">
|
|
733
|
+
<div class="architecture-card rounded-xl p-6 shadow-lg">
|
|
734
|
+
<div class="flex items-center mb-6">
|
|
735
|
+
<div class="bg-primary-500 p-3 rounded-lg mr-4 shadow-lg">
|
|
736
|
+
<i class="fas fa-vial text-white text-2xl"></i>
|
|
737
|
+
</div>
|
|
738
|
+
<h2 class="text-3xl font-bold">Testes Automatizados</h2>
|
|
739
|
+
</div>
|
|
740
|
+
|
|
741
|
+
<div class="code-block p-4 rounded-lg">
|
|
742
|
+
<pre class="text-gray-200 overflow-x-auto font-mono text-sm">
|
|
743
|
+
import { expect, describe, beforeAll, afterEach, test } from "vitest";
|
|
744
|
+
import { testApp } from "../esm/index.js";
|
|
745
|
+
|
|
746
|
+
let core = {};
|
|
747
|
+
|
|
748
|
+
beforeAll(async () => {
|
|
749
|
+
const { core: Core } = await testApp.run({
|
|
750
|
+
db: {
|
|
751
|
+
app: {
|
|
752
|
+
async findUnique(id) {
|
|
753
|
+
return { id, name: "dddd", desc: "ddddddd" };
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
});
|
|
758
|
+
|
|
759
|
+
core = Core;
|
|
760
|
+
|
|
761
|
+
Core.event("node").sub({ topic: "service::test.app" }, ({ data }) => {
|
|
762
|
+
console.log(data);
|
|
763
|
+
Core.event("node").pub({ topic: "test.app" }, { id: data.id });
|
|
764
|
+
});
|
|
765
|
+
});
|
|
766
|
+
|
|
767
|
+
describe("core", () => {
|
|
768
|
+
test("executa serviço principal", async () => {
|
|
769
|
+
const res = await core.service("test.app").execute({ name: "ddd" }, "node");
|
|
770
|
+
|
|
771
|
+
expect(res.data).toBeDefined();
|
|
772
|
+
expect(res.error).toBeUndefined();
|
|
773
|
+
expect(res.data.id).toBeDefined();
|
|
774
|
+
});
|
|
775
|
+
});
|
|
776
|
+
</pre>
|
|
777
|
+
</div>
|
|
778
|
+
</div>
|
|
779
|
+
</section>
|
|
780
|
+
|
|
781
|
+
<!-- Advanced Section -->
|
|
782
|
+
<section id="advanced" class="fade-in">
|
|
783
|
+
<div class="architecture-card rounded-xl p-6 shadow-lg">
|
|
784
|
+
<div class="flex items-center mb-6">
|
|
785
|
+
<div class="bg-primary-500 p-3 rounded-lg mr-4 shadow-lg">
|
|
786
|
+
<i class="fas fa-sliders-h text-white text-2xl"></i>
|
|
787
|
+
</div>
|
|
788
|
+
<h2 class="text-3xl font-bold">Configuração Avançada</h2>
|
|
789
|
+
</div>
|
|
790
|
+
|
|
791
|
+
<div class="code-block p-4 rounded-lg mb-6">
|
|
792
|
+
<pre class="text-gray-200 overflow-x-auto font-mono text-sm">
|
|
793
|
+
await app.run({
|
|
794
|
+
drivers: [
|
|
795
|
+
{
|
|
796
|
+
type: "nats",
|
|
797
|
+
name: "nats",
|
|
798
|
+
config: { servers: "nats://localhost:4222" }
|
|
799
|
+
},
|
|
800
|
+
{
|
|
801
|
+
type: "redis",
|
|
802
|
+
name: "redis",
|
|
803
|
+
config: { url: "redis://localhost:6379" }
|
|
804
|
+
},
|
|
805
|
+
{
|
|
806
|
+
type: "bull",
|
|
807
|
+
name: "bull",
|
|
808
|
+
config: { url: "redis://localhost:6379" }
|
|
809
|
+
}
|
|
810
|
+
],
|
|
811
|
+
servers: [
|
|
812
|
+
{
|
|
813
|
+
type: "http",
|
|
814
|
+
rootPath: "/api"
|
|
815
|
+
},
|
|
816
|
+
{
|
|
817
|
+
type: "ws",
|
|
818
|
+
route: "/ws",
|
|
819
|
+
driver: "nats"
|
|
820
|
+
},
|
|
821
|
+
{
|
|
822
|
+
type: "nats",
|
|
823
|
+
driver: "nats",
|
|
824
|
+
services: [
|
|
825
|
+
"test.app",
|
|
826
|
+
{ name: "test.app1", auth: "util:auth.apiKey" }
|
|
827
|
+
]
|
|
828
|
+
}
|
|
829
|
+
]
|
|
830
|
+
});
|
|
831
|
+
</pre>
|
|
832
|
+
</div>
|
|
833
|
+
|
|
834
|
+
<div class="lifecycle-flow p-6 rounded-lg">
|
|
835
|
+
<h3 class="text-xl font-bold mb-4 text-primary-300 text-center">Fluxo de Inicialização</h3>
|
|
836
|
+
<div class="flex flex-col items-center space-y-4">
|
|
837
|
+
<div class="flex items-center justify-center w-full">
|
|
838
|
+
<div class="bg-primary-600 text-white py-2 px-4 rounded-lg shadow-lg text-center w-48">
|
|
839
|
+
start.js
|
|
840
|
+
</div>
|
|
841
|
+
</div>
|
|
842
|
+
<div class="text-primary-400">
|
|
843
|
+
<i class="fas fa-arrow-down"></i>
|
|
844
|
+
</div>
|
|
845
|
+
<div class="flex items-center justify-center w-full">
|
|
846
|
+
<div class="bg-primary-600 text-white py-2 px-4 rounded-lg shadow-lg text-center w-48">
|
|
847
|
+
app.run(config)
|
|
848
|
+
</div>
|
|
849
|
+
</div>
|
|
850
|
+
<div class="text-primary-400">
|
|
851
|
+
<i class="fas fa-arrow-down"></i>
|
|
852
|
+
</div>
|
|
853
|
+
<div class="flex items-center justify-center w-full">
|
|
854
|
+
<div class="bg-primary-600 text-white py-2 px-4 rounded-lg shadow-lg text-center w-48">
|
|
855
|
+
index.js → bootstrap()
|
|
856
|
+
</div>
|
|
857
|
+
</div>
|
|
858
|
+
<div class="text-primary-400">
|
|
859
|
+
<i class="fas fa-arrow-down"></i>
|
|
860
|
+
</div>
|
|
861
|
+
<div class="flex items-center justify-center w-full">
|
|
862
|
+
<div class="bg-primary-600 text-white py-2 px-4 rounded-lg shadow-lg text-center w-48">
|
|
863
|
+
Serviço → Entidade → Repositório → DB
|
|
864
|
+
</div>
|
|
865
|
+
</div>
|
|
866
|
+
<div class="text-primary-400">
|
|
867
|
+
<i class="fas fa-arrow-down"></i>
|
|
868
|
+
</div>
|
|
869
|
+
<div class="flex items-center justify-center w-full">
|
|
870
|
+
<div class="bg-primary-600 text-white py-2 px-4 rounded-lg shadow-lg text-center w-48">
|
|
871
|
+
Eventos → Workers → Web → WS
|
|
872
|
+
</div>
|
|
873
|
+
</div>
|
|
874
|
+
</div>
|
|
875
|
+
</div>
|
|
876
|
+
|
|
877
|
+
<div
|
|
878
|
+
class="mt-8 bg-gradient-to-r from-primary-900/40 to-primary-800/40 p-6 rounded-lg border border-primary-700">
|
|
879
|
+
<h3 class="text-xl font-bold mb-4 text-primary-300">Conclusão</h3>
|
|
880
|
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
881
|
+
<div>
|
|
882
|
+
<p class="mb-4">
|
|
883
|
+
A integração de <strong>create-org-app</strong> com <code
|
|
884
|
+
class="file-path">index.js</code> e <code class="file-path">start.js</code>
|
|
885
|
+
fornece:
|
|
886
|
+
</p>
|
|
887
|
+
<ul class="space-y-2">
|
|
888
|
+
<li class="flex items-start">
|
|
889
|
+
<i class="fas fa-check-circle text-primary-400 mt-1 mr-2"></i>
|
|
890
|
+
<span>Arquitetura limpa e modular</span>
|
|
891
|
+
</li>
|
|
892
|
+
<li class="flex items-start">
|
|
893
|
+
<i class="fas fa-check-circle text-primary-400 mt-1 mr-2"></i>
|
|
894
|
+
<span>Ciclo de vida controlado (bootstrap/destroy)</span>
|
|
895
|
+
</li>
|
|
896
|
+
</ul>
|
|
897
|
+
</div>
|
|
898
|
+
<div>
|
|
899
|
+
<ul class="space-y-2">
|
|
900
|
+
<li class="flex items-start">
|
|
901
|
+
<i class="fas fa-check-circle text-primary-400 mt-1 mr-2"></i>
|
|
902
|
+
<span>Suporte nativo a múltiplos drivers e servidores</span>
|
|
903
|
+
</li>
|
|
904
|
+
<li class="flex items-start">
|
|
905
|
+
<i class="fas fa-check-circle text-primary-400 mt-1 mr-2"></i>
|
|
906
|
+
<span>Perfeita para microserviços e SaaS distribuídos</span>
|
|
907
|
+
</li>
|
|
908
|
+
</ul>
|
|
909
|
+
</div>
|
|
910
|
+
</div>
|
|
911
|
+
</div>
|
|
912
|
+
</div>
|
|
913
|
+
</section>
|
|
914
|
+
</main>
|
|
915
|
+
</div>
|
|
916
|
+
|
|
917
|
+
<!-- Footer -->
|
|
918
|
+
<footer class="gradient-bg text-white py-8 mt-12">
|
|
919
|
+
<div class="container mx-auto px-4">
|
|
920
|
+
<div class="flex flex-col md:flex-row justify-between items-center">
|
|
921
|
+
<div class="mb-4 md:mb-0">
|
|
922
|
+
<div class="flex items-center space-x-3">
|
|
923
|
+
<div class="bg-primary-500 p-2 rounded-lg">
|
|
924
|
+
<i class="fas fa-cube text-white"></i>
|
|
925
|
+
</div>
|
|
926
|
+
<div>
|
|
927
|
+
<h2 class="text-xl font-bold">create-org-app</h2>
|
|
928
|
+
<p class="mt-1 text-primary-200 text-sm">Framework Modular e Orientado a Eventos</p>
|
|
929
|
+
</div>
|
|
930
|
+
</div>
|
|
931
|
+
</div>
|
|
932
|
+
|
|
933
|
+
<div class="flex space-x-4">
|
|
934
|
+
<a href="#"
|
|
935
|
+
class="bg-primary-700 hover:bg-primary-600 w-10 h-10 rounded-full flex items-center justify-center transition-colors duration-200 shadow-lg">
|
|
936
|
+
<i class="fab fa-github"></i>
|
|
937
|
+
</a>
|
|
938
|
+
<a href="#"
|
|
939
|
+
class="bg-primary-700 hover:bg-primary-600 w-10 h-10 rounded-full flex items-center justify-center transition-colors duration-200 shadow-lg">
|
|
940
|
+
<i class="fab fa-npm"></i>
|
|
941
|
+
</a>
|
|
942
|
+
<a href="#"
|
|
943
|
+
class="bg-primary-700 hover:bg-primary-600 w-10 h-10 rounded-full flex items-center justify-center transition-colors duration-200 shadow-lg">
|
|
944
|
+
<i class="fas fa-book"></i>
|
|
945
|
+
</a>
|
|
946
|
+
</div>
|
|
947
|
+
</div>
|
|
948
|
+
|
|
949
|
+
<div class="border-t border-primary-700 mt-6 pt-6 text-center text-primary-300">
|
|
950
|
+
<p>© 2023 create-org-app. Todos os direitos reservados.</p>
|
|
951
|
+
</div>
|
|
952
|
+
</div>
|
|
953
|
+
</footer>
|
|
954
|
+
|
|
955
|
+
<script>
|
|
956
|
+
// Smooth scrolling for anchor links
|
|
957
|
+
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
|
|
958
|
+
anchor.addEventListener('click', function (e) {
|
|
959
|
+
e.preventDefault();
|
|
960
|
+
|
|
961
|
+
const targetId = this.getAttribute('href');
|
|
962
|
+
if (targetId === '#') return;
|
|
963
|
+
|
|
964
|
+
const targetElement = document.querySelector(targetId);
|
|
965
|
+
if (targetElement) {
|
|
966
|
+
window.scrollTo({
|
|
967
|
+
top: targetElement.offsetTop - 100,
|
|
968
|
+
behavior: 'smooth'
|
|
969
|
+
});
|
|
970
|
+
|
|
971
|
+
// Update active nav link
|
|
972
|
+
document.querySelectorAll('.nav-link').forEach(link => {
|
|
973
|
+
link.classList.remove('active');
|
|
974
|
+
});
|
|
975
|
+
this.classList.add('active');
|
|
976
|
+
}
|
|
977
|
+
});
|
|
978
|
+
});
|
|
979
|
+
|
|
980
|
+
// Update active nav link on scroll
|
|
981
|
+
window.addEventListener('scroll', () => {
|
|
982
|
+
const sections = document.querySelectorAll('section');
|
|
983
|
+
const navLinks = document.querySelectorAll('.nav-link');
|
|
984
|
+
|
|
985
|
+
let currentSection = '';
|
|
986
|
+
sections.forEach(section => {
|
|
987
|
+
const sectionTop = section.offsetTop - 150;
|
|
988
|
+
if (window.scrollY >= sectionTop) {
|
|
989
|
+
currentSection = section.getAttribute('id');
|
|
990
|
+
}
|
|
991
|
+
});
|
|
992
|
+
|
|
993
|
+
navLinks.forEach(link => {
|
|
994
|
+
link.classList.remove('active');
|
|
995
|
+
if (link.getAttribute('href') === `#${currentSection}`) {
|
|
996
|
+
link.classList.add('active');
|
|
997
|
+
}
|
|
998
|
+
});
|
|
999
|
+
});
|
|
1000
|
+
|
|
1001
|
+
// Theme toggle functionality
|
|
1002
|
+
const themeToggle = document.getElementById('theme-toggle');
|
|
1003
|
+
themeToggle.addEventListener('click', () => {
|
|
1004
|
+
document.documentElement.classList.toggle('dark');
|
|
1005
|
+
|
|
1006
|
+
const icon = themeToggle.querySelector('i');
|
|
1007
|
+
if (document.documentElement.classList.contains('dark')) {
|
|
1008
|
+
icon.classList.remove('fa-sun');
|
|
1009
|
+
icon.classList.add('fa-moon');
|
|
1010
|
+
} else {
|
|
1011
|
+
icon.classList.remove('fa-moon');
|
|
1012
|
+
icon.classList.add('fa-sun');
|
|
1013
|
+
}
|
|
1014
|
+
});
|
|
1015
|
+
|
|
1016
|
+
// Set initial active nav link
|
|
1017
|
+
document.querySelector('.nav-link').classList.add('active');
|
|
1018
|
+
</script>
|
|
1019
|
+
</body>
|
|
1020
|
+
|
|
1021
|
+
</html>
|