@getanthill/datastore
Version:
Event-Sourced Datastore
30 lines (29 loc) • 826 B
JavaScript
const fs = require('fs');
const https = require('https');
const options = {
key: fs.readFileSync(`${__dirname}/certs/server_key.pem`),
cert: fs.readFileSync(`${__dirname}/certs/server_cert.pem`),
ca: [fs.readFileSync(`${__dirname}/certs/ca_cert.pem`)],
// Requesting the client to provide a certificate, to authenticate.
requestCert: true,
// As specified as "true", so no unauthenticated traffic
// will make it to the specified route specified
rejectUnauthorized: true,
};
https
.createServer(options, function (req, res) {
console.log(
new Date() +
' ' +
req.connection.remoteAddress +
' ' +
req.method +
' ' +
req.url,
);
res.writeHead(200);
res.end('OK!\n');
})
.listen(8888, () => {
console.log('Listening on :8888');
});