File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import {
22 AccessLevel ,
33 SingletonProto ,
4- } from '@eggjs/tegg ' ;
4+ } from 'egg ' ;
55
66@SingletonProto ( {
77 accessLevel : AccessLevel . PUBLIC ,
Original file line number Diff line number Diff line change @@ -3,12 +3,12 @@ import {
33 HTTPMethod ,
44 HTTPMethodEnum ,
55 Context ,
6- type EggContext ,
6+ HTTPContext ,
77 HTTPQuery ,
88 Middleware ,
99 Inject ,
10- } from '@eggjs/tegg' ;
11- import type { EggLogger } from 'egg' ;
10+ type Logger ,
11+ } from 'egg' ;
1212
1313import { traceMethod } from '../middleware/trace_method.ts' ;
1414import { HelloService } from '../biz/HelloService.ts' ;
@@ -20,13 +20,13 @@ export class HelloController {
2020 private readonly helloService : HelloService ;
2121
2222 @Inject ( )
23- private readonly logger : EggLogger ;
23+ private readonly logger : Logger ;
2424
2525 @HTTPMethod ( {
2626 method : HTTPMethodEnum . GET ,
2727 path : '/hello' ,
2828 } )
29- async hello ( @Context ( ) ctx : EggContext , @HTTPQuery ( ) name : string ) {
29+ async hello ( @HTTPContext ( ) ctx : Context , @HTTPQuery ( ) name : string ) {
3030 this . logger . info ( 'access url: %s' , ctx . url ) ;
3131
3232 const message = await this . helloService . hello ( name ) ;
Original file line number Diff line number Diff line change 1- import type { EggContext , Next } from '@eggjs/tegg ' ;
1+ import type { Context , Next } from 'egg ' ;
22
3- export async function traceMethod ( ctx : EggContext , next : Next ) {
3+ export async function traceMethod ( ctx : Context , next : Next ) {
44 await next ( ) ;
55 ctx . body . data . message += ` (${ ctx . method } )` ;
66}
Original file line number Diff line number Diff line change 11import type { EggPlugin } from 'egg' ;
22
33const plugin : EggPlugin = {
4- tegg : {
5- enable : true ,
6- package : '@eggjs/tegg-plugin' ,
7- } ,
8- teggConfig : {
9- enable : true ,
10- package : '@eggjs/tegg-config' ,
11- } ,
12- teggController : {
13- enable : true ,
14- package : '@eggjs/tegg-controller-plugin' ,
15- } ,
164} ;
175
186export default plugin ;
Original file line number Diff line number Diff line change 2323 "license" : " MIT" ,
2424 "dependencies" : {
2525 "@eggjs/scripts" : " beta" ,
26- "@eggjs/tegg" : " beta" ,
27- "@eggjs/tegg-config" : " beta" ,
28- "@eggjs/tegg-controller-plugin" : " beta" ,
29- "@eggjs/tegg-plugin" : " beta" ,
3026 "egg" : " beta"
3127 },
3228 "devDependencies" : {
3733 "@eggjs/mock" : " beta" ,
3834 "eslint" : " 8" ,
3935 "eslint-config-egg" : " 14" ,
40- "typescript" : " 5" ,
41- "koa-compose" : " 4.1.0"
36+ "typescript" : " 5"
4237 },
4338 "repository" : " git@github.com:eggjs/examples.git" ,
4439 "engines" : {
You can’t perform that action at this time.
0 commit comments