node.js Generated code with oas3-tools version 2.2.3 does not take middleware
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-22-2022
09:01 AM
06-22-2022
09:01 AM
node.js Generated code with oas3-tools version 2.2.3 does not take middleware
I'm trying to add a middleware to the code generated by swaggerhub for node.js, it appears to ignore it and not use the middleware I'm adding:
const expressAppConfig = oas3Tools.expressAppConfig(path.join(__dirname, './api/openapi.yaml'), options);
const app = expressAppConfig.getApp();
app.use(cors());
app.use(xApiAuth);
app.use(helmet());
Labels:
- Labels:
-
Swagger Codegen
2 REPLIES 2
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2022
01:34 PM
09-23-2022
01:34 PM
I built a patch package to solve cors and middleware issues:
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2022
04:07 PM
09-24-2022
04:07 PM
Hello
I'm fairly new to node and very new to express and swagger. I've generated the nodejs server stubs and I've been beating my head against the wall trying to figure out how to add custom middleware and business logic.
Your solution looks promising but I'm trying to understand it.
1) Where are the middleware functions like helmet() etc... defined?
2) Is custom middleware not supported in the current nodejs server stubs?
Thanks.
1) Is it otherwise not possible to add custom middleware
