New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

feliz

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

feliz

A minimalistic wrapper for hapi.js to build servers

latest
Source
npmnpm
Version
0.0.17
Version published
Maintainers
1
Created
Source

Hapi Rx

A minimalistic wrapper for hapi.js to build servers

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
    }
}

Keywords

rx

FAQs

Package last updated on 26 Jul 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts