Hopefully a simple question,
npm install http
works fine and I can connect via port 80 to third party services.
npm install https
by contrast does not latch on to a recognized package
Though I see a reference to package https here:
HTTP GET Request in Node.js Express
What's the https
analog to package http
in node.js / Express?
To built an HTTPS server with nodeJs, we need an SSL (Secure Sockets Layer) certificate. We can create a self-signed SSL certificate on our local machine. Let's first create an SSL certificate on our machine first. After running this command, we would get some options to fill.
Open a command prompt: Run as Administrator. Navigate to directory c:/Apache24/bin. Add Apache as a Windows Service: httpd.exe -k install -n "Apache HTTP Server"
Node has in-built modules including http, https, and http2 that provide methods to implement and work with different HTTP protocols.
So Node itself has both modules to create a http server and an https server:
Meaning you don't need NPM to get those working, they exist even before NPM itself.
On the other hand NPM will give you access to those great modules/framework.
Express is a framework based on connect blabla... it is awesome to make API or Website as long as you are not looking for a full coffee maker framework. There are a few built on top of Express like railways.js
Request to make HTTP ou HTTPS queries. Request is awesome, it keeps getting better and is today by far the best tool to grab any web content from a node app. If what you are looking for is to do a scraper you may want to look at cheerio.
PS: I took the time to give a good answer. But you should know that the best quality of a developer is to be able to read the docs rather than cry from help without even looking at the doc. My two cents.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With