Created
July 14, 2019 15:16
-
-
Save hzburki/ebaf46480f7fb4a811cf3502a299b72c to your computer and use it in GitHub Desktop.
User controller - NestJS SequelizeJS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Controller, Get, Post, Body } from '@nestjs/common'; | |
import { UserService } from './user.service'; | |
import { User } from './user.entity'; | |
@Controller('user') | |
export class UserController { | |
constructor(private readonly userService: UserService) {} | |
@Get() | |
public async getUsers(): Promise<User[]> { | |
return this.userService.getAllUsers(); | |
} | |
@Post() | |
public async createUser(@Body() body): Promise<User> { | |
return this.userService.createUser(body); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment