2

my issue: I have server written using Spring Boot, Spring Data, MongoDB and postgreSQL. My client is written with React/Redux. I keep them in two separated git repos. Now I’d like to deploy them to Heroku. I already deployed back end but now I’m not sure how to add frontend. I’d prefer to have it as one app because then I wouldn’t have to worty about csrf.

what solutions I was thinking about: As far as I’m concerned I see two solutions: 1) deploying front end as a separated app and make calls to backend (already deployed app) 2) somehow making it into one app. I read a couple of solutions and one suggested making a Procfile, but in that question there was one git repo. Deploy two separate heroku apps from same git repo

I’m using Maven and Yarn.

werw werw
  • 221
  • 1
  • 3
  • 16

1 Answers1

0

If your client project is also a maven project, you can make it a dependency of your server project.

You can then make the build copy your client artifact into the src/main/resources/static folder and have your server application serve the client as static content.

Update: This link is a good guide how to do it: https://blog.jdriven.com/2016/12/angular2-spring-boot-getting-started/

It describes a multi module maven project with a spring rest backend- and an angularjs frontend module. But I am certain that the principle will work also with a react/redux frontend in a separate project.

It will require some tweaking though:)

Jens Krogsboell
  • 1,093
  • 11
  • 18