dolphin-server-modules 1.1.0 → 1.1.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/DOLPHIN_MASTER_GUIDE_NEPALI.md +24 -0
- package/README.md +7 -0
- package/package.json +2 -1
|
@@ -282,6 +282,30 @@ app.post('/auth/2fa/setup', auth.middleware(), async (ctx) => {
|
|
|
282
282
|
const result = await auth.setup2FA(ctx.req.user.id);
|
|
283
283
|
ctx.json(result); // QR Code URL यहाँ आउँछ
|
|
284
284
|
});
|
|
285
|
+
|
|
286
|
+
### ७.५ कस्टम कन्ट्रोलर (Custom Controllers)
|
|
287
|
+
यदि तपाईँलाई अटोमेटेड CRUD ले पुग्दैन भने, तपाईँ आफ्नै कन्ट्रोलर लेख्न सक्नुहुन्छ। Dolphin मा एउटा राम्रो कन्ट्रोलर यस्तो हुनुपर्छ:
|
|
288
|
+
|
|
289
|
+
```typescript
|
|
290
|
+
// src/controllers/userController.ts
|
|
291
|
+
export const userController = {
|
|
292
|
+
getProfile: async (ctx) => {
|
|
293
|
+
const user = ctx.req.user;
|
|
294
|
+
if (!user) return ctx.status(401).json({ error: "Unauthorized" });
|
|
295
|
+
|
|
296
|
+
// केही जटिल लजिक यहाँ...
|
|
297
|
+
ctx.json({
|
|
298
|
+
id: user.id,
|
|
299
|
+
email: user.email,
|
|
300
|
+
serverTime: new Date()
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
};
|
|
304
|
+
```
|
|
305
|
+
यसलाई राउटमा यसरी प्रयोग गर्नुहोस्:
|
|
306
|
+
```typescript
|
|
307
|
+
import { userController } from './controllers/userController';
|
|
308
|
+
app.get('/me', auth.middleware(), userController.getProfile);
|
|
285
309
|
```
|
|
286
310
|
|
|
287
311
|
---
|
package/README.md
CHANGED
|
@@ -6,6 +6,13 @@
|
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
+
### 📘 Official Master Guide (Nepal)
|
|
10
|
+
Dolphin Framework को विस्तृत र आधिकारिक गाइड अब उपलब्ध छ। यसमा **Auth, CRUD, Models, र Controllers** को १००% ट्युटोरियल समावेश छ।
|
|
11
|
+
|
|
12
|
+
👉 **[Dolphin Master Guide (PDF)](https://github.com/Phuyalshankar/dolphin-server-modules/blob/main/DOLPHIN_MASTER_GUIDE_NEPALI.pdf)**
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
9
16
|
## 🚀 Core Philosophy
|
|
10
17
|
- **Zero-Dependency Core**: Built on the native Node.js `http` module. No Express, no Fastify overhead.
|
|
11
18
|
- **Extreme Modularity**: Use only what you need. Auth, CRUD, and Routing are all independent.
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dolphin-server-modules",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
|
+
"homepage": "https://github.com/Phuyalshankar/dolphin-server-modules#readme",
|
|
4
5
|
"description": "Core utility modules for Auth, CRUD, and Controllers",
|
|
5
6
|
"main": "dist/index.js",
|
|
6
7
|
"types": "dist/index.d.ts",
|