Skip to content

Instantly share code, notes, and snippets.

@hzburki
Created July 14, 2019 15:16
Show Gist options
  • Save hzburki/ebaf46480f7fb4a811cf3502a299b72c to your computer and use it in GitHub Desktop.
Save hzburki/ebaf46480f7fb4a811cf3502a299b72c to your computer and use it in GitHub Desktop.
User controller - NestJS SequelizeJS
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