Skip to content

Commit

Permalink
fix: fix benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
czy88840616 committed Sep 6, 2018
1 parent 7f803a9 commit 13734f5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
@@ -1,11 +1,11 @@
import { controller, get, provide, Controller } from 'midway';
import { controller, get, provide } from 'midway';

@provide()
@controller('/')
export class HomeController extends Controller {
export class HomeController {

@get('/')
async index() {
this.ctx.body = `Welcome to midwayjs!`;
async index(ctx) {
ctx.body = `Welcome to midwayjs!`;
}
}
@@ -1,16 +1,16 @@
import { controller, Controller, get, inject, provide } from 'midway';
import { controller, get, inject, provide } from 'midway';
import { IUserResult, IUserService } from '../../interface';

@provide()
@controller('/user')
export class UserController extends Controller {
export class UserController {
@inject('userService')
service: IUserService;

@get('/:id')
async getUser(): Promise<void> {
const id: number = this.ctx.params.id;
async getUser(ctx): Promise<void> {
const id: number = ctx.params.id;
const user: IUserResult = await this.service.getUser({id});
this.ctx.body = {success: true, message: 'OK', data: user};
ctx.body = {success: true, message: 'OK', data: user};
}
}

0 comments on commit 13734f5

Please sign in to comment.