GithubHelp home page GithubHelp logo

fusionjs / fusion-plugin-http-handler Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 8.0 340 KB

Migrated to https://github.com/fusionjs/fusionjs

License: MIT License

Shell 3.77% JavaScript 95.31% Dockerfile 0.93%

fusion-plugin-http-handler's Introduction

fusion-plugin-http-handler

Build status

Provides a way to hook http handlers into the fusion request lifecycle.


Table of contents


Installation

yarn add fusion-plugin-http-handler

Usage

import HttpHandlerPlugin, {HttpHandlerToken} from 'fusion-plugin-http-handler';
import App from 'fusion-react';
import express from 'express';

const expressApp = __NODE__ && express();
if (__NODE__) {
  expressApp.get('/test', (req, res) => {
    res.end('OK');
  });
}

export default function main() {
  const app = new App(<div>Hello world</div>);
  if (__NODE__) {
    app.register(HttpHandlerPlugin);
    app.register(HttpHandlerToken, expressApp);
  }
  return app;
}

Configuration

You can configure whether to run the middleware before or after await next. The default is running after await next.

import {HttpHandlerConfigToken} from 'fusion-plugin-http-handler';

// Configure to run before await next
if (__NODE__) {
  app.register(HttpHandlerConfigToken, {defer: false});
}

fusion-plugin-http-handler's People

Contributors

renovate[bot] avatar ganemone avatar alexmsmithca avatar kevingrandon avatar dennisgl avatar chrisdothtml avatar renovate-bot avatar derekjuber avatar lhorie avatar

Stargazers

 avatar

Watchers

Ryan Tsao avatar James Cloos avatar

fusion-plugin-http-handler's Issues

Improve error handling

Fix a bug where errors are not correctly bubbled up to fusion
middleware error handlers.

0.1.5 breaks proxy-compat/bedrock-compat auth header behavior

Type of issue

Bug

Description

Similar to #73 and likely the same root cause, this update breaks proxy-compat behavior in that auth headers are no longer being sent to the proxy endpoint.

Current behavior

Headers like x-auth-params-email, specified via mock headers would be inserted into the proxy endpoints.

Expected behavior

Headers are no longer being sent to the proxy endpoints.

Steps to reproduce

  1. Update from 0.1.4 to 0.1.5.

0.1.5 breaks initial-state-compat behavior

Type of issue

Bug

Description

This seems to have broken the @uber/fusion-plugin-initial-state-compat behavior, since it no longer finds the res.locals.state as the initial-state-compat always runs before the express handlers that add res.locals.

Current behavior

initial-state-compat no longer adds any state from initial state loaded from express hooks/plugins that call res.putState.

Expected behavior

initial-state-compat adds initial state as expected.

Steps to reproduce

  1. Upgrade from fusion-plugin-http-handler 0.1.4 to 0.1.5

Your environment

  • fusion-plugin-http-handler version: 0.1.5

  • @uber/fusion-plugin-initial-state-compat: 0.1.2

  • Node.js version (node --version): v8.12.0

Originally posted by @chrisirhc in #67 (comment)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.