Repository navigation
API to use the generated certificates #20
Description
Activity
Hi @onerinas!
Take a look to the
getCerts()functions. I could try to make it available programmatically.
Then you can start the server withhttps.createServer(await getCerts(), app).listen(port)Otherwise, we can add a parameter to the
createServer()or thelisten()functions to pas theapp, but I'm not sure that cover all the possibilities. Probably a lambda would be better but at this point providinggetCerts()would be more or less the same.PS: I will be on a trip next week, don't throw in the towel if you don't hear me, I'll be back next weekend and I'll read all the messages ;)
No problem at all, enjoy your trip and thank you for the quick response!
Then you can start the server with https.createServer(await getCerts(), app).listen(port)
Yes, I was hoping for something like that.
Fine, next weekend I'll try to rearrange the structure to expose
getCerts()👌I've forked the repo to use in our project. Here is the commit: onerinas@ae6386e
usage:
https.createServer(await httpsLocalhost.getCerts(), app)I don't have any tests to create a PR here.
- added a commit that references this issue
on Aug 30, 2019 Hi @onerinas,
I checked your PR #22 but contains breaking changes.In particular, it changes the current use from
const httpsLocalhost = require("https-localhost") const app = httpsLocalhost()
to
const httpsLocalhost = require("https-localhost").app const app = httpsLocalhost()
Actually, I won't push a breaking change now. Maybe in the future, but I will totally remove express in that case.
I've created a branch that should solve your problem.
I paste an example for clarity:
const httpsLocalhost = require("https-localhost")() // const app = ... // const port = 443 const certs = await httpsLocalhost.getCerts() const server = https.createServer(certs, app).listen(port)
Let me know if this solution can work for you.
Yes, this would work!
Fine!
I'll publish it in the next few days together with other changes.
Reacted by Rinas- added a commit that references this issue
on Sep 2, 2019
How would you like to expand the functionalities?
Ability to generate and use certs directly for the existing server
Are there alternatives?
https://socket.io/docs/#Using-with-Express
Is it a breaking change?
Probably yes, depending upon what would be resulting API when this feature is implemented