'Angular HTTPS and HTTP requests to API

I have certificated my angular app to run over https by adding

ssl: true, 
sslKey: key, 
sslCrt: crt 

to my angular.json and I run via

ng serve --ssl --host: 0.0.0.0

It works fine on https://localhost:4200

Problem is that it throws this error on the browser:

Mixed Content: The page at '' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint ''

I haven't been able to find a solution.

It seems that I am making the API calls to my services via http like:

http://localhost/api/...

where I should make it https://localhost/api/... ?

If that is the case, how can I do this via nodejs, express and mongodb?

If that is not the case, what is?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source