addServerName, removeServerName, ServerName.js
This commit is contained in:
parent
0e63c77bd0
commit
f77d07014a
3 changed files with 99 additions and 15 deletions
26
examples/ServerName.js
vendored
Normal file
26
examples/ServerName.js
vendored
Normal 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);
|
||||
}
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue