vasuzex 2.0.13 → 2.0.14
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.
|
@@ -12,10 +12,16 @@ export function generateApiPackageJsonTemplate(appName) {
|
|
|
12
12
|
"version": "1.0.0",
|
|
13
13
|
"type": "module",
|
|
14
14
|
"imports": {
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
15
|
+
"#database": "../../../database/index.js",
|
|
16
|
+
"#database/*": "../../../database/*",
|
|
17
|
+
"#models/*": "../../../database/models/*",
|
|
18
|
+
"#config/*": "../../../config/*",
|
|
19
|
+
"#controllers/*": "./src/controllers/*",
|
|
20
|
+
"#services/*": "./src/services/*",
|
|
21
|
+
"#middleware/*": "./src/middleware/*",
|
|
22
|
+
"#routes/*": "./src/routes/*",
|
|
23
|
+
"#requests/*": "./src/requests/*",
|
|
24
|
+
"#helpers/*": "./src/helpers/*"
|
|
19
25
|
},
|
|
20
26
|
"scripts": {
|
|
21
27
|
"dev": "nodemon src/index.js",
|
|
@@ -75,9 +81,9 @@ export function generateAuthControllerTemplate() {
|
|
|
75
81
|
* Handles user registration, login, and authentication
|
|
76
82
|
*/
|
|
77
83
|
|
|
78
|
-
import { BaseController } from '
|
|
79
|
-
import { AuthService } from '
|
|
80
|
-
import { LoginRequest, RegisterRequest } from '
|
|
84
|
+
import { BaseController } from '#controllers/BaseController.js';
|
|
85
|
+
import { AuthService } from '#services/AuthService.js';
|
|
86
|
+
import { LoginRequest, RegisterRequest } from '#requests/AuthRequests.js';
|
|
81
87
|
|
|
82
88
|
export class AuthController extends BaseController {
|
|
83
89
|
constructor() {
|
|
@@ -257,7 +263,7 @@ export function generateAuthServiceTemplate() {
|
|
|
257
263
|
|
|
258
264
|
import bcrypt from 'bcryptjs';
|
|
259
265
|
import jwt from 'jsonwebtoken';
|
|
260
|
-
import { User } from '
|
|
266
|
+
import { User } from '#database';
|
|
261
267
|
|
|
262
268
|
export class AuthService {
|
|
263
269
|
/**
|
|
@@ -357,8 +363,8 @@ export function generateAuthMiddlewareTemplate() {
|
|
|
357
363
|
* Verify JWT token and attach user to request
|
|
358
364
|
*/
|
|
359
365
|
|
|
360
|
-
import { AuthService } from '
|
|
361
|
-
import { User } from '
|
|
366
|
+
import { AuthService } from '#services/AuthService.js';
|
|
367
|
+
import { User } from '#database';
|
|
362
368
|
|
|
363
369
|
export async function authMiddleware(req, res, next) {
|
|
364
370
|
try {
|