Closed sakurayang closed 2 years ago
when I use this package in Nodejs use .js file, node tell me expressify is not a functiuon . sandbox
expressify is not a functiuon
import uWS from "uWebSockets.js"; import expressify from "uwebsockets-express"; const uwsApp = uWS.App(); uwsApp.ws("/ws", { /* Options */ compression: uWS.SHARED_COMPRESSOR, maxPayloadLength: 16 * 1024 * 1024, idleTimeout: 16, /* Handlers */ open: (ws) => {}, message: (ws, message, isBinary) => { /* Ok is false if backpressure was built up, wait for drain */ let ok = ws.send(message, isBinary); }, drain: (ws) => { console.log("WebSocket backpressure: " + ws.getBufferedAmount()); }, close: (ws, code, message) => { console.log("WebSocket closed"); } }); const app = expressify(uwsApp); app.listen(9000, (token) => { if (token) { console.log("Listening to port " + 9000); } else { console.log("Failed to listen to port " + 9000); } });
Hi @sakurayang, when using plain JavaScript it is required to use expressify.default(uwsApp)
expressify.default(uwsApp)
when I use this package in Nodejs use .js file, node tell me
expressify is not a functiuon
. sandbox