UNPKG

uws-pack

Version:

Repack of [uWebSockets.js](https://github.com/uNetworking/uWebSockets.js).

62 lines (45 loc) 1.54 kB
# uws-pack Repack of [uWebSockets.js](https://github.com/uNetworking/uWebSockets.js). > **Note:** Major versions of the `uws-pack` package utilize the same Node.js native binaries (`uws_${process.platform}_${process.arch}_${process.versions.modules}.node`) and code as the corresponding major versions of the `uWebSockets.js` package. ## Changes - full ESM ## Installation ```sh yarn add uws-pack ``` ### Alternative Use dependency alias: ```sh yarn add uWebSockets.js@npm:uws-pack@20.0.0 ``` ## Usage ```ts import { App } from 'uws-pack' const port = +(process.env.PORT || 3000) const app = App() .listen(port, (listenSocket) => { if (listenSocket) { console.log(`Server running at http://localhost:${port}`) } else { console.log(`Failed to listen to port ${port}`) } }) ``` With [Alternative](#alternative) usage is the same of [uWebSockets.js](https://github.com/uNetworking/uWebSockets.js): ```ts import { App } from 'uWebSockets.js' const port = +(process.env.PORT || 3000) const app = App() .listen(port, (listenSocket) => { if (listenSocket) { console.log(`Server running at http://localhost:${port}`) } else { console.log(`Failed to listen to port ${port}`) } }) ``` --- > **Note**: For more info, see `uWebSockets.js` [Documentation](https://unetworking.github.io/uWebSockets.js/generated/index.html). ## License This project is licensed under the [MIT License](LICENSE). Licenses for third-party projects are listed in [THIRD-PARTY-LICENSE](THIRD-PARTY-LICENSE).