35 lines
946 B
TypeScript
35 lines
946 B
TypeScript
import { Body, Controller, Delete, Get, HttpCode, HttpStatus, Param, Patch, Post } from '@nestjs/common';
|
|
|
|
@Controller('events')
|
|
export class EventsController {
|
|
@Get()
|
|
getEvents(): string{
|
|
return "Aqui irán los eventos"
|
|
}
|
|
|
|
/* @Get(':id')
|
|
getEvent(@Param() params){
|
|
return `El evento que estamos llamando es: ${params.id}`
|
|
} */
|
|
|
|
@Get(':id')
|
|
getEvent(@Param('id') id: string): string{
|
|
return `El evento que estamos llamando es: ${id}`
|
|
}
|
|
|
|
@Post()
|
|
/* @HttpCode(HttpStatus.NO_CONTENT) esta linea es para no teornar nada*/
|
|
createEvent(@Body('message') message: string){
|
|
return `el evento creado es: ${message}`
|
|
}
|
|
|
|
@Delete(':id')
|
|
deleteEvent(@Param('id') id:string): string{
|
|
return `Estamos borrando el evento: ${id}`
|
|
}
|
|
|
|
@Patch(':id')
|
|
updateEvent(@Param('id') id:string, @Body() body){
|
|
return `Actualizando el evento: ${id}`
|
|
}
|
|
} |