deco-express 0.1.1 → 0.1.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/README.md CHANGED
@@ -16,7 +16,7 @@ npm install deco-express reflect-metadata
16
16
 
17
17
  ```ts
18
18
  // src/main.ts
19
- import "reflect-metadata";
19
+ import 'reflect-metadata';
20
20
  ```
21
21
 
22
22
  Also ensure your `tsconfig.json` includes:
@@ -35,25 +35,25 @@ Also ensure your `tsconfig.json` includes:
35
35
  ## Quick Start
36
36
 
37
37
  ```ts
38
- import "reflect-metadata";
39
- import express from "express";
40
- import Joi from "joi";
41
- import { Controller, Route, Validate, defineRoutes } from "deco-express";
38
+ import 'reflect-metadata';
39
+ import express from 'express';
40
+ import Joi from 'joi';
41
+ import { Controller, Route, Validate, defineRoutes } from 'deco-express';
42
42
 
43
43
  const createUserSchema = Joi.object({
44
44
  name: Joi.string().required(),
45
45
  email: Joi.string().email().required(),
46
46
  });
47
47
 
48
- @Controller("/users")
48
+ @Controller('/users')
49
49
  class UserController {
50
- @Route("get", "/list")
50
+ @Route('get', '/list')
51
51
  async list(req, res) {
52
52
  res.json({ users: [] });
53
53
  }
54
54
 
55
55
  @Validate(createUserSchema)
56
- @Route("post", "/create")
56
+ @Route('post', '/create')
57
57
  async create(req, res) {
58
58
  res.status(201).json({ created: req.body });
59
59
  }
package/dist/index.d.mts CHANGED
@@ -80,7 +80,7 @@ declare function Controller(baseRoute?: string): (target: object) => void;
80
80
  * }
81
81
  * ```
82
82
  */
83
- declare function Validate(schema: Joi.Schema): (_target: object, _propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
83
+ declare function Validate(schema: Joi.ObjectSchema): (_target: object, _propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
84
84
 
85
85
  /** Any class constructor that produces instances of type `T`. */
86
86
  type Constructor<T = object> = new (...args: unknown[]) => T;
package/dist/index.d.ts CHANGED
@@ -80,7 +80,7 @@ declare function Controller(baseRoute?: string): (target: object) => void;
80
80
  * }
81
81
  * ```
82
82
  */
83
- declare function Validate(schema: Joi.Schema): (_target: object, _propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
83
+ declare function Validate(schema: Joi.ObjectSchema): (_target: object, _propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
84
84
 
85
85
  /** Any class constructor that produces instances of type `T`. */
86
86
  type Constructor<T = object> = new (...args: unknown[]) => T;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deco-express",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "author": "ndrolp",
5
5
  "description": "Decorator-based utilities for building Express.js REST APIs in TypeScript",
6
6
  "main": "./dist/index.js",