@forinda/kickjs 0.1.6 → 0.2.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Felix Orinda
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -239,6 +239,7 @@ import { LoggingMiddleware } from "./middlewares/logging.middleware";
239
239
 
240
240
  export const AppModule = createModule("app", {
241
241
  controllers: [UserController],
242
+ services: [UserService], // Register your services
242
243
  middlewares: [LoggingMiddleware] // Optional: DI-managed middlewares
243
244
  });
244
245
  ```
@@ -258,10 +259,8 @@ import {
258
259
  KickAppMiddleware,
259
260
  KickRequest,
260
261
  KickResponse,
261
- KickNextFn,
262
- KickInject
262
+ KickNextFn
263
263
  } from "@forinda/kickjs";
264
- import { LoggerService } from "../services/logger.service";
265
264
 
266
265
  @KickMiddleware({
267
266
  name: "RequestLogger",
@@ -270,19 +269,14 @@ import { LoggerService } from "../services/logger.service";
270
269
  tags: ["logging", "development"]
271
270
  })
272
271
  export class LoggingMiddleware implements KickAppMiddleware {
273
- constructor(
274
- @KickInject(LoggerService)
275
- private readonly logger: LoggerService
276
- ) {}
277
-
278
272
  use(req: KickRequest, res: KickResponse, next: KickNextFn): void {
279
273
  const start = Date.now();
280
274
 
281
- this.logger.info(`→ ${req.method} ${req.url}`);
275
+ console.log(`→ ${req.method} ${req.url}`);
282
276
 
283
277
  res.on('finish', () => {
284
278
  const duration = Date.now() - start;
285
- this.logger.info(`← ${req.method} ${req.url} ${res.statusCode} (${duration}ms)`);
279
+ console.log(`← ${req.method} ${req.url} ${res.statusCode} (${duration}ms)`);
286
280
  });
287
281
 
288
282
  next();