Socket
Socket
Sign inDemoInstall

funl

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    funl

Fastest, baddest and most experimental HTTP/2 framework for Node.js


Version published
Weekly downloads
2
Maintainers
1
Install size
27.8 kB
Created
Weekly downloads
 

Readme

Source

Fastest, baddest and most experimental HTTP/2 framework for Node.js

Installation

Install from npm, note that funl requires Node 8.4.0 and above with the --expose-http2 for 8.x.x versions.

$ npm install funl --save

Write a funl Http/2 server

const Funl = require('funl');
const app = new Funl({
  cert: "", // SSL Cert
  key: "" // SSL Key
});

app.on('/', async (stream) => {
  stream.end("Hello World!");
});

app.listen(8080);

A short bit on Multiplexing and Stream Objet

Http/2 has many differences from Http/1.1, perhaps the most notable difference is multiplexing. For this reason routing in funl is not mapped to a request but rather to a substream. This interface allows you to push handles from a specific path without redefining them.

Write a middleware

Middlewares are special handles in funl that allow for interception of streams pre and post processing/flight. You can add a middleware preflight executing before all handles are consumed and postflight after the handles are done. A stream may or may not be open when postflight handles are called.

app.preflight(async (stream) => {
  console.log({ method: stream.method });
});

app.postflight(async (stream) => {
  console.log({ headers: stream.headers });
});

Middlewares can be called via internal requests (push) and don't map into an actual client-side request.

License

Who doesn't love a MIT license?

Keywords

FAQs

Last updated on 17 Aug 2017

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc