user.ts 438 B

123456789101112131415161718
  1. import { Inject, HTTPController, HTTPMethod, HTTPMethodEnum, HTTPQuery } from '@eggjs/tegg';
  2. import { HelloService } from '@/module/foo';
  3. @HTTPController({
  4. path: '/bar',
  5. })
  6. export class UserController {
  7. @Inject()
  8. helloService: HelloService;
  9. @HTTPMethod({
  10. method: HTTPMethodEnum.GET,
  11. path: 'user',
  12. })
  13. async user(@HTTPQuery({ name: 'userId' }) userId: string) {
  14. return await this.helloService.hello(userId);
  15. }
  16. }