Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@hapipal/hecks

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hapipal/hecks

Mount your express app onto your hapi server, aw heck!

  • 3.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
720
decreased by-42.03%
Maintainers
1
Weekly downloads
 
Created
Source

hecks

Mount your express app onto your hapi server, aw heck!

Build Status Coverage Status

Lead Maintainer - Devin Ivy

Usage

See also the API Reference

Hecks is intended for use with hapi v19+ and nodejs v12+ (see v2 for lower support).

Hecks allows you to seamlessly incorporate express applications into a hapi v17+ server. This is particularly useful for testing an express server using server.inject(), for unifying deployment of existing express and hapi applications, and as an initial stepping stone in migrating an express application to hapi.

const Express = require('express');
const BodyParser = require('body-parser');
const Hapi = require('@hapi/hapi');
const Hecks = require('@hapipal/hecks');

(async () => {

    const app = Express();

    app.post('/user', BodyParser.json(), (req, res) => {

        const user = { ...req.body };
        user.saved = true;

        res.json(user);
    });

    const server = Hapi.server();

    await server.register([
        Hecks.toPlugin(app, 'my-express-app')
    ]);

    const { result } = await server.inject({
        method: 'post',
        url: '/user',
        payload: { name: 'Bill', faveFood: 'cactus' }
    });

    console.log(result); // {"name":"Bill","faveFood":"cactus","saved":true}
})();

Keywords

FAQs

Package last updated on 05 Jan 2021

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc