This wrapper makes it very easy to construct a new instance of an Express.js web server application using HTTP or HTTPs.
Features include:
.ws('path', (socket, request) => void)
https://gibme-npm.github.io/webserver/
import WebServer, { Logger } from '@gibme/webserver';
(async() => {
const app = WebServer.create({
autoStartTunnel: true
});
app.get('/', (request, response) => {
return response.json({ success: true });
})
app.ws('/wss', (socket) => {
socket.on('message', msg => {
// simply echo the message back
socket.send(msg);
});
});
await app.start();
Logger.info('Listening on: %s', app.localUrl);
Logger.info('Listening on: %s', app.tunnelUrl);
Logger.info('Listening on: %s', app.url);
})();