Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

@sportnak
Copy link

No description provided.

@ejball ejball requested a review from ddunkin October 30, 2018 03:33
Copy link
Contributor

@ddunkin ddunkin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this instead be solved with a parent app? E.g.

const app = express();
app.use(myMiddleware);
app.use(createApp(service));

code.WriteLine("const app = express();");
code.WriteLine("app.use(bodyParser.json());");
code.WriteLine("app.use(bodyParser.urlencoded({ extended: true }));");
code.WriteLine("middleware.forEach(func => app.use(func));");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test if middleware is truthy.


code.WriteLine();
using (code.Block("export function createApp(service" + IfTypeScript($": I{capModuleName}") + ")" + IfTypeScript(": express.Application") + " {", "}"))
using (code.Block("export function createApp(service" + IfTypeScript($": I{capModuleName}") + ", middleware" + IfTypeScript(": ((...args: any[]) => void)[]") + ")" + IfTypeScript(": express.Application") + " {", "}"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

middleware should be optional.

@sportnak
Copy link
Author

Ah yeah, we could probably just do the parent app, thanks.

@sportnak sportnak closed this Oct 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.