angus-c / fusion-plugin-http-handler

A fusion plugin for integrating an existing http handler into the fusion request lifecycle

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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;
}

About

A fusion plugin for integrating an existing http handler into the fusion request lifecycle

License:MIT License


Languages

Language:JavaScript 94.6%Language:Shell 4.4%Language:Dockerfile 1.1%