Replace express with native node calls #1674

Closed
opened 2025-08-09 17:21:15 +00:00 by fergalmoran · 0 comments
Owner

Originally created by @gregbty on 12/9/2015

I updated the old express calls to use the ones provided by the base node framework.

There are two other changes I wanted to suggest as well. If a module is not found an error is thrown which results in a non-graceful shutdown of the process. This in turn results in a generic exception in .NET which does not give any indication of the error that actually occurred within the node process.

throw new Error('The module "' + resolvedPath + '" has no export named "' + bodyJson.exportedFunctionName + '"');

This also applies to the logic used in react-rendering.js. I would propose ensuring that all errors bubble up to the client without causing the process to end unexpectedly i.e. wrapping the logic inside of a try/catch block and sending the error via the http pipeline before ending the process.

I can submit an additional PR if needed.

*Originally created by @gregbty on 12/9/2015* I updated the old express calls to use the ones provided by the base node framework. There are two other changes I wanted to suggest as well. If a module is not found an error is thrown which results in a non-graceful shutdown of the process. This in turn results in a generic exception in .NET which does not give any indication of the error that actually occurred within the node process. ``` node throw new Error('The module "' + resolvedPath + '" has no export named "' + bodyJson.exportedFunctionName + '"'); ``` This also applies to the logic used in `react-rendering.js`. I would propose ensuring that all errors bubble up to the client without causing the process to end unexpectedly i.e. wrapping the logic inside of a try/catch block and sending the error via the http pipeline before ending the process. I can submit an additional PR if needed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/JavaScriptServices#1674
No description provided.