doc: add esm examples to node:tls
#56229
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds the missing
ESM
counterparts of theCJS
examples for the TLS (SSL) documentation.While I normally try not to touch the current
CJS
examples, this time I went ahead and destructured the (require
) imports following a feedback I had received in a previous PR so that examples from bothCJS
andESM
are as similar as possible so new users don't get confused.I've also taken the liberty to add a snippet to explain how to generate the necessary files for both the client and the echo server examples similar to what I had done for the
https.createServer
example so new users can try them out of the box sorta speak, or at least without having to search for the extra-steps.I've tested every single example and they all work/behave as expected but tell me what you think and I can update them!
Best regards!