24 lines
491 B
TypeScript
24 lines
491 B
TypeScript
import { Controller, Get } from '@nestjs/common';
|
|
import { Query } from '@nestjs/graphql';
|
|
import { EventsService } from './events.service';
|
|
import { EventEntity } from './events.entity';
|
|
|
|
@Controller('/api/events')
|
|
export class EventsController {
|
|
|
|
constructor(
|
|
|
|
private readonly eventsService: EventsService
|
|
|
|
|
|
){}
|
|
|
|
@Get("/")
|
|
@Query(()=>[EventEntity])
|
|
async events(): Promise<EventEntity[]>{
|
|
|
|
return await this.eventsService.getEvents();
|
|
|
|
}
|
|
}
|