23 lines
577 B
TypeScript
23 lines
577 B
TypeScript
|
|
import { Controller, Get, Post, Body, Delete, Param } from '@nestjs/common';
|
||
|
|
import { KeywordsService } from './keywords.service';
|
||
|
|
|
||
|
|
@Controller('api/keywords')
|
||
|
|
export class KeywordsController {
|
||
|
|
constructor(private readonly keywordsService: KeywordsService) {}
|
||
|
|
|
||
|
|
@Get()
|
||
|
|
findAll() {
|
||
|
|
return this.keywordsService.findAll();
|
||
|
|
}
|
||
|
|
|
||
|
|
@Post()
|
||
|
|
create(@Body('word') word: string, @Body('weight') weight: number) {
|
||
|
|
return this.keywordsService.create(word, weight);
|
||
|
|
}
|
||
|
|
|
||
|
|
@Delete(':id')
|
||
|
|
remove(@Param('id') id: string) {
|
||
|
|
return this.keywordsService.remove(id);
|
||
|
|
}
|
||
|
|
}
|