addServerName, removeServerName, ServerName.js

This commit is contained in:
Alex Hultman 2020-08-17 03:57:37 +02:00
parent 0e63c77bd0
commit f77d07014a
3 changed files with 99 additions and 15 deletions

26
examples/ServerName.js vendored Normal file
View file

@ -0,0 +1,26 @@
/* Minimal SSL example using ServerNameIndication */
const uWS = require('../dist/uws.js');
const port = 9001;
const app = uWS.SSLApp({
key_file_name: 'misc/key.pem',
cert_file_name: 'misc/cert.pem',
passphrase: '1234'
}).addServerName("localhost", {
key_file_name: 'misc/key.pem',
cert_file_name: 'misc/cert.pem',
passphrase: '1234'
}).removeServerName("localhost").addServerName("localhost", {
key_file_name: 'misc/key.pem',
cert_file_name: 'misc/cert.pem',
passphrase: '1234'
}).get('/*', (res, req) => {
res.end('Hello World!');
}).listen(port, (token) => {
if (token) {
console.log('Listening to port ' + port);
} else {
console.log('Failed to listen to port ' + port);
}
});