-
Notifications
You must be signed in to change notification settings - Fork 577
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use @ServerlessTrigger replace functions in f.yml (#919)
- Loading branch information
1 parent
3d2388f
commit a85af14
Showing
23 changed files
with
839 additions
and
148 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,6 @@ export class ControllerTestService { | |
@Inject() | ||
ctx; | ||
|
||
|
||
@Get('/') | ||
async handler() { | ||
return 'user' | ||
|
21 changes: 21 additions & 0 deletions
21
packages-serverless/serverless-app/test/fixtures/faas-v2/src/func.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { Get, Inject, Provide, Query, ServerlessTrigger, ServerlessTriggerType } from '@midwayjs/decorator'; | ||
|
||
@Provide() | ||
export class FuncService { | ||
|
||
@Inject() | ||
ctx; | ||
|
||
@ServerlessTrigger(ServerlessTriggerType.HTTP, { | ||
method: 'get', | ||
path: '/func/http/get' | ||
}) | ||
async handler(@Query() name) { | ||
return 'user:' + name; | ||
} | ||
|
||
@Get('/:test') | ||
async test() { | ||
return this.ctx.params.test; | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { WebRouterCollector } from './webRouterCollector'; | ||
|
||
export class ServerlessTriggerCollector extends WebRouterCollector { | ||
protected async analyze() { | ||
this.options.includeFunctionRouter = true; | ||
return super.analyze(); | ||
} | ||
|
||
protected collectRoute(module) { | ||
super.collectRoute(module, true); | ||
} | ||
|
||
protected collectFunctionRoute(module) { | ||
super.collectFunctionRoute(module, true); | ||
} | ||
|
||
async getFunctionList(): Promise<any[]> { | ||
return this.getFlattenRouterTable(); | ||
} | ||
} |
Oops, something went wrong.