diff --git a/packages/cli/src/routeGeneration/templates/express.hbs b/packages/cli/src/routeGeneration/templates/express.hbs index ef9388215..896fb8c8e 100644 --- a/packages/cli/src/routeGeneration/templates/express.hbs +++ b/packages/cli/src/routeGeneration/templates/express.hbs @@ -85,10 +85,16 @@ export function RegisterRoutes(app: Router) { authenticateMiddleware({{json security}}), {{/if}} {{#if uploadFile}} - upload.fields({{json uploadFileName}}), - {{/if}} - {{#if uploadFiles}} - upload.array('{{uploadFilesName}}'), + upload.fields([ + {{#each uploadFileName}} + { + name: {{json name}}, + {{#if maxCount}} + maxCount: {{maxCount}} + {{/if}} + }{{#if @last}}{{else}},{{/if}} + {{/each}} + ]), {{/if}} ...(fetchMiddlewares({{../name}})), ...(fetchMiddlewares({{../name}}.prototype.{{name}})), diff --git a/packages/cli/src/routeGeneration/templates/hapi.hbs b/packages/cli/src/routeGeneration/templates/hapi.hbs index 52101c15e..8a3626a67 100644 --- a/packages/cli/src/routeGeneration/templates/hapi.hbs +++ b/packages/cli/src/routeGeneration/templates/hapi.hbs @@ -89,13 +89,6 @@ export function RegisterRoutes(server: any) { multipart: true, allow: 'multipart/form-data' }, - {{else if uploadFiles}} - payload: { - output: 'stream', - parse: true, - multipart: true, - allow: 'multipart/form-data' - }, {{/if}} handler: {{#if ../../iocModule}}async {{/if}}function {{../name}}_{{name}}(request: Request, h: ResponseToolkit) { const args: Record = { diff --git a/packages/cli/src/routeGeneration/templates/koa.hbs b/packages/cli/src/routeGeneration/templates/koa.hbs index 176666c6a..2f4f4e36b 100644 --- a/packages/cli/src/routeGeneration/templates/koa.hbs +++ b/packages/cli/src/routeGeneration/templates/koa.hbs @@ -81,10 +81,16 @@ export function RegisterRoutes(router: KoaRouter) { authenticateMiddleware({{json security}}), {{/if}} {{#if uploadFile}} - upload.fields({{json uploadFileName}}), - {{/if}} - {{#if uploadFiles}} - upload.array('{{uploadFilesName}}'), + upload.fields([ + {{#each uploadFileName}} + { + name: {{json name}}, + {{#if maxCount}} + maxCount: {{maxCount}} + {{/if}} + }{{#if @last}}{{else}},{{/if}} + {{/each}} + ]), {{/if}} ...(fetchMiddlewares({{../name}})), ...(fetchMiddlewares({{../name}}.prototype.{{name}})),