Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to run an app after installing certificates for localhost #5516

Closed
ybico opened this issue Mar 2, 2024 · 2 comments
Closed

How to run an app after installing certificates for localhost #5516

ybico opened this issue Mar 2, 2024 · 2 comments
Labels

Comments

@ybico
Copy link

ybico commented Mar 2, 2024

Hi everyone, I need some help because I'm very new doing all of this.
Currently, I have myapp running perfectly on http://localhost/myapp
Now, I would like to have it running on https://localhost/myapp
I have correctly installed the certificates and the https://localhost is on and it displays a message: "Hello, HTTPS World!"
Now, how can I run myapp on https://localhost/myapp ??

myapp is a directory located in C:\Apache24\htdocs\myapp

The code of my server.js file is:
const app = require('express')();
const https = require('https');
const fs = require('fs');

const options = {
key: fs.readFileSync('build/cert/server.key'),
cert: fs.readFileSync('build/cert/server.crt'),
}
https.createServer(options, (req, res) => {
res.writeHead(200);
res.end('Hello, HTTPS World!');
}).listen(443, () => {
console.log('Server is running on port 443');
});

OS: Win 10
Any help or hint will be much appreciated.

@ybico ybico added the question label Mar 2, 2024
@wesleytodd
Copy link
Member

Here are the relevant docs. http://expressjs.com/en/4x/api.html#app.listen

FYI, for future reference, we do not to technical support here. Please use stackoverflow or reddit to ask general questions like this. This is for bugs, features, and otherwise improving the express project itself. Thanks.

@ybico
Copy link
Author

ybico commented Mar 3, 2024

Sorry, however, thnks for the link @wesleytodd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants