E4E7 fusion-plugin-http-handler/README.md at master · UberOpenSourceBot/fusion-plugin-http-handler · GitHub
[go: up one dir, main page]

Skip to content

Latest commit

 

History

History
46 lines (33 loc) · 933 Bytes

File metadata and controls

46 lines (33 loc) · 933 Bytes

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', (<
34C4
span class="pl-s1">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;
}
0