• Decorator for PUT endpoints

    Parameters

    • path: string

      The route path

    Returns ((target, propertyKey, descriptor) => PropertyDescriptor)

      • (target, propertyKey, descriptor): PropertyDescriptor
      • Parameters

        • target: any
        • propertyKey: string
        • descriptor: PropertyDescriptor

        Returns PropertyDescriptor

    Example

    @put("/api/users/:id")
    async updateUser(req: KosRequest<"/api/users/:id">, res: KosResponse) {
    const userId = req.params.id;
    const updates = req.body;
    const updatedUser = await this.userService.updateUser(userId, updates);
    res.status(200).send(updatedUser);
    }