I'm looking for a solution to my development flow problem.
In a nutshell, I have a front-end (React, NPM) and a back-end (Spring Boot 2, Gradle)
I'd like to have the back-end serve the front-end files itself (instead of serving them via a separate Express server which I've done in the past).
However, I don't want to put them in the resource directory and have the back-end build pipeline to also build the front-end, because they I'd have to recompile for each little change. Instead, I'd like to be able to use an NPM command (like npm start
) which will watch and build my front-end code continuously.
This means I want the front-end files to be outside of the otherwise standalone JAR.
My problem is, I can't figure out a good mechanism to be able to reference it in a relative manner. I know I can put it at an absolute path to find it, but that would mean each dev has to set that up (and doesn't work if multiple projects are being developed with the same type of workflow).
How can I either reference my public
directory in a relative way or otherwise have those files built outside the back-end build pipeline?