Reputation: 10604
I have the following structure:
/ -> root
/react-app -> Reason app (initialized using cli)
/webapp -> gradle app, maven structure with Gradle build file
I am not sure how to build everything so I can:
application
plugin for example)The production should look like this:
In other words, I would like to serve everything from single web app.
I am aware that I could make 2 separate services - one for react, one for API. But I want to bundle this together into single app.
Local development should be quick. I was thinking in having separate React and API part for the local purpose only, as that is easier to run locally. But for production I need those two to be served from single app.
is a single Gradle in the root and having modules. While ktor can be a module, I am not sure how to operate with react module.
Upvotes: 1
Views: 407
Reputation: 11607
I'm not sure about the Kotlin and Ktor parts, but on the Reason/React side I'd recommend Parcel to bundle your HTML/JS/CSS assets into a form suitable for serving statically, and also use it as a development server for fast iteration.
Parcel requires zero config for most cases and you can point it at your entrypoint asset, usually your index.html
file in your UI project, and in production builds it will bundle everything (HTML/JS/CSS) inside a dist/
subdirectory ready to be served. Then just point your Kotlin webapp to serve dist/index.html
for the /
route.
For development builds Parcel will automatically start up a development server at localhost:1234
with auto-reloading. When you're iterating on the UI, the BuckleScript incremental build along with the Parcel reload, should be pretty fast–usually almost instant.
Upvotes: 1