Unbundling Spring (maven) bundled SPA (AngularJS)!

Time to move away from legacy code structure and use SPA’s the right way.

folder structure

“OK, so what is the problem with that?”

Obstacles when splitting them apart

My solution

npm install express --save-dev
npm install http-proxy-middleware --save-dev
"scripts": {
"start": "node server.js"
"main": "server.js",
var express = require('express');
var proxy = require('http-proxy-middleware');
var app = express();
app.use('/', express.static(__dirname + '/'));app.use('/<path-to-proxy>', proxy({target: process.env.PROXY_HOST, changeOrigin: true}));
app.use('/<another-path-to-proxy>', proxy({target: process.env.PROXY_HOST, changeOrigin: true}));
app.listen(8080, 'localhost');console.log("MyProject Server is Listening on port 8080");
PROXY_HOST=<host-name> npm start




Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store