Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/reekoheek/node-bono-io

The node-bono socket.io connection
https://github.com/reekoheek/node-bono-io

Last synced: 23 days ago
JSON representation

The node-bono socket.io connection

Awesome Lists containing this project

README

        

# node-bono-io

The node-bono socket.io connection

## Install

```javascript
npm i reekoheek/bono-io
```

## Configuration

Server configuration:

```javascript
const http = require('http');
const Bundle = require('bono');
const app = new Bundle();

app.get('/', ctx => {
ctx.body = 'Hello world!';
})

const server = http.Server(app.callback());

require('bono-io/server')(app).attach(server);

server.listen(3000, () => console.log('Listening at http://localhost:3000/'));
```

Client configuration:

```html




Bono IO



(async () => {
// set default headers
io.socket.setHeaders({
'Authorization': 'Bearer xxx',
});

let result = await io.socket.get('/');
console.log(result);
})();

```