Update README.md
This commit is contained in:
parent
0393102704
commit
0dd72f7bdc
33
README.md
33
README.md
@ -1,17 +1,24 @@
|
|||||||
Loopery is Google V8 tied to µWebSockets for building high performance JavaScript backend services.
|
**µWebSockets.js** is a JavaScript platform, runtime and web server. It can serve Http about 6x that of Node.js and 12x that of Deno and outperforms Golang's fasthttp with ease.
|
||||||
|
|
||||||
|
There are two modes; compiled as a stand-alone JavaScript runtime or as a Node.js native addon.
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
const uWS = require('...lalala');
|
/* The stand-alone runtime has uWS namespace already loaded. */
|
||||||
|
var uWS = uWS ? uWS : require('../dist/uws.js');
|
||||||
|
|
||||||
const app = uWS.SSLApp({
|
const world = 'Strings are slower than ArrayBuffer but who cares for demo purose!';
|
||||||
cert: 'my_cert.pem',
|
const port = 3000;
|
||||||
key: 'my_key.pem'
|
|
||||||
}).get('/whatsmy/useragent', (res, req) => {
|
uWS.App().get('/hello', (res, req) => {
|
||||||
res.end('Hello ' + req.getHeader('user-agent'));
|
res.end(world);
|
||||||
}).get('/*', (res, req) => {
|
}).get('/*', (res, req) => {
|
||||||
res.end('Hello otherwise!');
|
res.writeHeader('content-type', 'text/html; charset= utf-8').end(req.getHeader('user-agent') + ' är din user agent, biatch!');
|
||||||
}).listen(3000, 0, (token) => {
|
}).listen(port, (token) => {
|
||||||
console.log('Listening to port 3000');
|
if (token) {
|
||||||
|
console.log('Listening to port ' + port);
|
||||||
|
} else {
|
||||||
|
console.log('Failed to listen to port ' + port);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -20,10 +27,10 @@ Performance retention is up to 70% of native C++ µWebSockets v0.15.
|
|||||||
![](benchmarks.png)
|
![](benchmarks.png)
|
||||||
|
|
||||||
### Kick-start
|
### Kick-start
|
||||||
The following works for Linux and macOS systems:
|
Easiest is to compile yourself a Node.js native addon. The following works for Linux and macOS systems:
|
||||||
```
|
```
|
||||||
git clone --recursive https://github.com/uNetworking/uWebSockets-node.git
|
git clone --recursive https://github.com/uNetworking/uWebSockets.js.git
|
||||||
cd uWebSockets-node
|
cd uWebSockets.js
|
||||||
make
|
make
|
||||||
node examples/HelloWorld.js
|
node examples/HelloWorld.js
|
||||||
```
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user