Provides a way to hook http handlers into the fusion request lifecycle.
yarn add fusion-plugin-http-handler
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;
}
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
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
- 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
- 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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.