| [ Web Proxy ] |
| Viewing: https://riptutorial.com/express/example/25517/using-https-with-express | [Back] [Original] |
[logo rip]
First you have to generate public and private keys using OpenSSL(tutorial).
var express = require("express");
var http =require ("http");
var https=require ("https");
var fs=require("fs");
var app=express();
var httpsKeys={
key:fs.readFileSync("<key.pem>");
crtifcte:fs.readFileSync("<certificate.pem>");
};
http.createserver(app).listen(3000);
https.createserver(httpsKeys,app).listen(3030);
| Web Proxy Viewer | New URL | Original Page |