I'm trying to combine my static landing page with the express.js app (react.js single page app).
On my landing page, I set up proxy using http-proxy-middleware
My server.js for the static page looks like that:
var express = require('express');
var app = express();
var path = require('path');
var proxy = require('http-proxy-middleware');
var options = {
target: 'http://localhost:9000', // the app
changeOrigin: true
};
var exampleProxy = proxy(options);
app.use('/app', exampleProxy);
app.use(express.static(__dirname + '/'))
app.listen(8080);
The problem is that when I get to localhost:8080/app/ I have access to correct index.html, but I cannot fetch the resources, the bundle.js is being fetched like that: http://localhost:8080/bundle.js
, but apparently it is available on localhost:9000, not 8080
How do I make it so as the app has access to its static files?