# hapi-rx

> A minimalistic wrapper for hapi.js using reactive extensions.

Latest version **0.0.5** (published 2016-07-05) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install hapi-rx
pnpm add hapi-rx
yarn add hapi-rx
bun add hapi-rx
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.0.5 |
| Published | 2016-07-05 |
| First published | 2016-02-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Known vulnerabilities | 0 (+3 in 2 direct dependencies) |
| Install scripts | no |
| Author | Héctor Menéndez |
| Maintainers | etor |
| Keywords | observable, hapi, hapi.js, socket, socket.io, server |

## Links

- npm: https://www.npmjs.com/package/hapi-rx
- Repository: https://github.com/gikmx/hapi-rx
- Homepage: https://github.com/gikmx/hapi-rx#readme
- Issues: https://github.com/gikmx/hapi-rx/issues
- npm.io page: https://npm.io/package/hapi-rx

## Dependencies (5)

- [hapi](https://npm.io/package/hapi.md) ^13.4.1
- [rxjs](https://npm.io/package/rxjs.md) ^5.0.0-beta.9
- [socket.io](https://npm.io/package/socket.io.md) ^1.4.8
- [lodash.merge](https://npm.io/package/lodash.merge.md) ^4.4.0
- [socketio-wildcard](https://npm.io/package/socketio-wildcard.md) ^0.3.0

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 0.0.5 (latest) — 2016-07-05
- 0.0.4 — 2016-07-04
- 0.0.3 — 2016-06-29
- 0.0.2 — 2016-02-29
- 0.0.1 — 2016-02-29

## README

Hapi Rx
-------

A simple wrapper for Hapi.js & Socket.IO


## Usage
__index.js__

    'use strict'
    const HapiRx = require('hapi-rx');

    const server$ = HapiRx({
        root: './app',
    });

    server$.subscribe(
        hapirx => console.log('Server running.'),
        err    => { throw err; }
    )

__app/routes.js__

    'use strict';

    const Joi = require('joi');

    module.exports = {

        '/{id?}': {
            method: 'GET',
            bundle: 'root',
            config: {
                cache: false,
                validate: {
                    params:{
                        id: Joi.string().regex(/[a-f0-9]{24}/)
                    }
                }
            }
        },

        'action':{
            method: 'SOCKET',
            bundle: 'socket'
        },

    }

__app/bundles/root/index.js__

    'use strict'

    module.exports = (request, reply){
        let path = this.path.bundles; // Access to the server instance
        if (request.params.id) return reply(`Hello ${request.params.id}`);
        reply('Hello world');
    }

__app/bundles/socket.js__

    'use strict'
    // Still in alpha
    module.exports = (type, data){
        // emited using channel: socket:test
        if (type == 'test'){
            // do something with data
        }
    }

---
_Source: https://npm.io/package/hapi-rx · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
