How to use the ts-express-decorators.Authenticated function in ts-express-decorators

To help you get started, we’ve selected a few ts-express-decorators examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github scopsy / node-typescript-starter / src / controllers / user / user.controller.ts View on Github external
import { Controller, Get, PathParams, Authenticated, Required, Req } from 'ts-express-decorators';
import { Returns } from 'ts-express-decorators/lib/swagger';
import { User } from '../../dal/User';
import { UserService } from '../../services/user/user.service';
import { IAppRequest } from '../../types/app.types';

@Controller('/users')
@Authenticated()
export class UserController {
    constructor(
        private userService: UserService
    ) {

    }

    @Get('/:id([0-9a-f]{24})')
    @Returns(User)
    async getUser(@Required() @PathParams('id') id: string): Promise {
        return await this.userService.getUserById(id);
    }

    @Get('/auth-test')
    async authTest(@Req() req: IAppRequest): Promise {