I have a working website (https://example.com/ ) with PHP, apache2, MySQL in ubuntu 18
I do want to create API (https://example.com/api) using nodejs and express js. So we have installed node js and started working on making a Nodejs app inside /api
( on same ubuntu machine ). we could easily access our API without https (http://example.com/api) but when we try with https (https://example.com/api) it is not working at all. And the main website is still working fine with https.
I do not understand why https is not working for /api folder but it is working for the whole website. I have tried some other solution but nothing is working for me. Because many solutions are recommending to use Nginx. But I am not familiar with Nginx at all and we have a lot of custom configuration for apache2 and no idea how we could archive that.
Here is the simple code which is written on index.js inside /api
folder
app.get('/',function (req, res, next) {
res.json({
'success': {
'message': 'done'
}
});
});
Any help will be appreciated. Thanks
Edit:
I tried with the answer from this question (Enabling HTTPS on express.js) and it is working with https, now I am concern about, is it the right way to implement SSL ? or we should try to get it done with apache config file