Skip to content

Commit

Permalink
added ability to pass multer instance into RegisterRoutes
Browse files Browse the repository at this point in the history
  • Loading branch information
lalchan committed Oct 3, 2023
1 parent c5e1bb4 commit e1f058e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/cli/src/routeGeneration/templates/koa.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import multer from '@koa/multer';
{{else}}
const multer = require('@koa/multer');
{{/if}}
const upload = multer({{{json multerOpts}}});
{{/if}}

// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
Expand Down Expand Up @@ -59,7 +58,11 @@ const validationService = new ValidationService(models);

// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

export function RegisterRoutes(router: KoaRouter) {
export function RegisterRoutes(app: Router, registerOptions: RegisterRoutesOptions = {}) {
{{#if useFileUploads}}
// NOTE: If registerOptions.multer is passed to this function, then it will override the multer options from `tsoa.json`
const upload = registerOptions.multer || multer({{{json multerOpts}}});
{{/if}}
// ###########################################################################################################
// NOTE: If you do not see routes for all of your controllers in this file, then you might not have informed tsoa of where to look
// Please look into the "controllerPathGlobs" config option described in the readme: https://github.com/lukeautry/tsoa
Expand Down

0 comments on commit e1f058e

Please sign in to comment.