Open misostack opened 2 years ago
Naming Controller: ExamplesController
Method | Endpoint | Params | Method | Description | Success Status | Response |
---|---|---|---|---|---|---|
GET | /examples | Query Param : ?filter={}&pageNumber=1&pageSize=10 | index | List examples | Success: 200 | Example[] |
POST | /examples | Body : JSON data ExampleDTO | create | Create new example | Success: 201 | Example or exampleId |
GET | /examples/{id} | Route Param: id | show | Get details of an example | Success: 200 | Example |
PATCH | /examples/{id} | Route Param: id Body : JSON data ExampleUpdateDTO | update | Update an example partially | Success: 200 | exampleId |
DELETE | /examples/{id} | Route Param : id | remove | Delete an example | Success: 204 | No content |
@Controller('examples')
export class ExamplesController {
constructor(private exampleService: ExampleService) {}
// index, show, create, update, destroy
@Get()
index() {
return [];
}
@Get(':id')
show() {
return {};
}
@Post('')
create(@Body() payload): Example {
const example: Example = this.exampleService.create(payload);
return example;
}
@Patch(':id')
update() {
return {};
}
@Delete(':id')
destroy() {
return {};
}
}
Includes: