import { Controller , Request , Get , Post , UseGuards , Res } from '@nestjs/common' ; import { AuthGuard } from '@nestjs/passport' ; import * as path from 'path' ; import { Response } from 'express' ; require ( 'dotenv' ) . config ( { path : path . resolve ( process . cwd ( ) , 'apps/bootcamp-api/.env' ) } ) ; @ Controller ( ) export class AppController { constructor ( ) { } @ Get ( 'appinfo' ) getAppInfo ( @ Res ( ) res , @ Request ( ) req ) { var pkg = require ( path . join ( __dirname , '/../../../../package.json' ) ) ; res . json ( { name : pkg . name , version : pkg . version , status : 'up' } ) ; } @ UseGuards ( AuthGuard ( 'jwt' ) ) @ Get ( 'profile' ) getProfile ( @ Request ( ) req ) { return req . user ; } }