How Can I Setting Up HTTPS for using a Web API

I'm currently working on a project that involves setting up HTTPS for a web API, and I've run into a few challenges along the way. My project centers around webcam functionality. To ensure that the web API is accessible via HTTPS, I attempted to use tools like browser-sync and http-server to facilitate HTTPS serving during local development. Regrettably, these tools did not function as anticipated. For instance, in the case of browser-sync, I adhered to the provided documentation and followed these steps:
# install it globally
npm install -g browser-sync
# start https server
browser-sync start --https
# install it globally
npm install -g browser-sync
# start https server
browser-sync start --https
Subsequently, I incorporated the script into my HTML file. However, upon accessing the localhost link, the browser displayed the browser-sync configuration page instead of my project, as evidenced in the screenshot. I would be tremendously appreciative if someone could offer guidance or share their insights regarding the process of establishing HTTPS for a web API.
No description
No description
5 Replies
b1mind
b1mind16mo ago
maybe this will help?
issam seghir
issam seghirOP16mo ago
No description
b1mind
b1mind16mo ago
You sure you have to?
issam seghir
issam seghirOP16mo ago
yes and no, This project is for learning purposes but making the webcam work locally according to MDN HTTPS is required, see : https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia
MediaDevices: getUserMedia() method - Web APIs | MDN
The MediaDevices.getUserMedia() method prompts the user for permission to use a media input which produces a MediaStream with tracks containing the requested types of media.
Want results from more Discord servers?
Add your server