http-party / create-servers Goto Github PK
View Code? Open in Web Editor NEWCreate an http AND/OR an https server and call the same request handler.
License: MIT License
Create an http AND/OR an https server and call the same request handler.
License: MIT License
A common thing that servers may need customized is keepAliveTimeout
. Presently you'd have to mutate that property on the returned server objects. Could it be useful to set that via the config parameters passed into createServers
?
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 }
}
We shouldn't use fs.readFileSync
. That being said it's part of the startup flow and what are you doing before your https
server listens that's so important? What are you? The space pope or something?
When creating an HTTPS
server and starting it without root
access. The callback receives an error Unspecified error instead of useful debugging message that states why the server creation has failed.
If there are multiple failures, the error message should default to the first error that it encountered.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.