Task: Fixed and updated for export all functions for decorators
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Sambo Chea 2021-09-15 20:17:30 +07:00
parent 923e08949b
commit dd445a22c0
4 changed files with 5 additions and 7 deletions

View File

@ -1,6 +1,5 @@
import { Request, Response } from "express" import { Request, Response } from "express"
import Controller from "../decorators/controller.decorator" import { Controller, Get } from "../decorators"
import { Get } from "../decorators/handlers.decorator"
@Controller("/hello") @Controller("/hello")
export default class IndexController { export default class IndexController {

View File

@ -1,6 +1,5 @@
import { Request, Response } from "express" import { Request, Response } from "express"
import Controller from "../decorators/controller.decorator" import { Controller, Delete, Get, Post } from "../decorators"
import { Post, Get, Delete } from "../decorators/handlers.decorator"
const persons: Array<any> = [ const persons: Array<any> = [
{ {

View File

@ -1,9 +1,7 @@
import { MetadataKeys } from "../constants/metadata.keys" import { MetadataKeys } from "../constants/metadata.keys"
const Controller = (basePath: string): ClassDecorator => { export const Controller = (basePath: string): ClassDecorator => {
return (target: any) => { return (target: any) => {
Reflect.defineMetadata(MetadataKeys.BASE_PATH, basePath, target) Reflect.defineMetadata(MetadataKeys.BASE_PATH, basePath, target)
} }
} }
export default Controller

2
src/decorators/index.ts Normal file
View File

@ -0,0 +1,2 @@
export * from "./controller.decorator"
export * from "./handlers.decorator"