uWebSockets.js/examples/HelloWorld.js

19 lines
456 B
JavaScript
Raw Normal View History

2019-01-17 06:22:31 +00:00
/* Minimal SSL/non-SSL example */
2018-10-28 15:07:21 +00:00
2019-01-17 06:26:25 +00:00
const uWS = require('../dist/uws.js');
2018-12-26 18:19:26 +00:00
const port = 9001;
const app = uWS./*SSL*/App({
2018-12-26 12:50:12 +00:00
key_file_name: '/home/alexhultman/key.pem',
cert_file_name: '/home/alexhultman/cert.pem',
passphrase: '1234'
2019-01-17 06:22:31 +00:00
}).get('/*', (res, req) => {
res.end('Hello World!');
2018-10-28 15:07:21 +00:00
}).listen(port, (token) => {
if (token) {
console.log('Listening to port ' + port);
} else {
console.log('Failed to listen to port ' + port);
}
});