You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I tried following the moleculer framework documentation for uploading the file as multipart, by making change in ApiGateway route & setting the aliases with the rest route as mutlipart:service.action. Below is the snap of the ApiGateway settings
{path: "/api2",authorization: true,//run method `authorize` before calling handler// Use bodyparser modulebodyParsers: {json: false,urlencoded: false},mappingPolicy: "all",aliases: {// File upload from HTML multipart form"POST /v2.dataviewer.upload": "multipart:v2.dataviewer.upload"},// Route level busboy config.// More info: https://github.com/mscdex/busboy#busboy-methodsbusboyConfig: {limits: {files: 1}// Can be defined limit event handlers// `onPartsLimit`, `onFilesLimit` or `onFieldsLimit`},// Call before `broker.call`onBeforeCall(ctx,route,req){this.addExtraMetaData_beforeCall(ctx,route,req);},// Call after `broker.call` and before send back the responseonAfterCall(ctx,route,req,res,data){this.addExtraMetaData_afterCall(ctx,route,req,res,data);//do stuffleturlSplit=req.url.split('/'),services='/'+urlSplit[1]+'/'+urlSplit[2];// Increment this metric (api.usage.total) counter by 1 everytime a particular api is called.// This metric is used in grafana to see how many times this api is called by a individual userthis.broker.metrics.increment("api.usage.total",{endpoint: req.url,services: services,login: ctx.meta.user.login,version: this.version},1);//!important, has to return data after doing stuffreturndata;},onError(req,res,err){// Increment this metric (api.error.total) counter by 1 everytime there is an error in API call.// This metric is used in grafana to see how many times API failed for user levelthis.formatAndSendError(res,err);this.broker.metrics.increment("api.error.total",{endpoint: req.url,login: req.$ctx.meta.user ? req.$ctx.meta.user.login : "@unauthorized",version: this.version},1);}}
But still in the service layer I'm getting undefined in the service Action method
Hello,
I tried following the moleculer framework documentation for uploading the file as multipart, by making change in ApiGateway route & setting the aliases with the rest route as mutlipart:service.action. Below is the snap of the ApiGateway settings
But still in the service layer I'm getting undefined in the service Action method
Any help is highly appreciated.
The text was updated successfully, but these errors were encountered: