UNPKG

uwebsockets

Version:

µWebSockets.js is a web server bypass for Node.js that reimplements eventing, networking, encryption, web protocols, routing and pub/sub in highly optimized C++. As such, µWebSockets.js (websockets) delivers web serving for Node.js, 8.5x that of Fastify a

19 lines (16 loc) 430 B
/* Minimal SSL/non-SSL example */ const uWS = require('../dist/uws.js'); const port = 9001; const app = uWS./*SSL*/App({ 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); } });