cra-middleware
Run a create-react-app as a connect middleware.
This is mainly a proof of concept.
Usage
- Create an app with
create-react-app
. - Instantiate
cra-middleware
with the path to your app.
const express = require('express');
const path = require('path');
const craMiddleware = require('cra-middleware');
const app = express();
app.get('/api/hello', (req, res) => res.send('world'));
app.use('/', craMiddleware(path.resolve(__dirname, '../my-app')));
app.listen(3000);
To Do
- Needs better interfacing with the subprocess. It would be nice to have some
ready
/compile
/error
events. - Still seems to block node from cleanly exiting.
- Hooks?
- Logging options?