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
create-servers allows you to configure a single http server using the object syntax or multiple http server instances using an array with objects where each object the configuration for each server. While that is a nice feature to have it comes with a really painful side effect and that is that the response signature of the module changes based on the configuration. When the servers are configured using just a single object to create a single server the servers response would be:
{
http: { http server }
}
But when you are providing create-servers with an array of multiple configurations, the response signature magically changes to an array:
{
http: [
{ http server 1 },
{ http server 2 }
]
}
So in order to handle both formats, implementers of this library need to support both cases, and normalise it into workable format for their library. What I like to propose instead is that the create-servers changes it's response signature to be consistent between both configuration modes (array and object).
One way of doing this would be to return an object that is keyed on the address of the server instead of separate distinction between http, https, and then the multiple or single server that is created. So in the case of multiple servers, there would simply be more keys in the object allowing the signature to be the same.
{
80: { http server },
8080: { http server },
443: { http server }
}
The text was updated successfully, but these errors were encountered:
create-servers
allows you to configure a single http server using the object syntax or multiple http server instances using an array with objects where each object the configuration for each server. While that is a nice feature to have it comes with a really painful side effect and that is that the response signature of the module changes based on the configuration. When the servers are configured using just a single object to create a single server theservers
response would be:But when you are providing create-servers with an array of multiple configurations, the response signature magically changes to an array:
So in order to handle both formats, implementers of this library need to support both cases, and normalise it into workable format for their library. What I like to propose instead is that the
create-servers
changes it's response signature to be consistent between both configuration modes (array and object).One way of doing this would be to return an object that is keyed on the address of the server instead of separate distinction between http, https, and then the multiple or single server that is created. So in the case of multiple servers, there would simply be more keys in the object allowing the signature to be the same.
The text was updated successfully, but these errors were encountered: