Skip to content

How to share models between frontend and backend #58

Answered by marcvk
marcvk asked this question in Q&A
Discussion options

You must be logged in to vote

Ok, with the help of a little AI, I've figured out that you can in fact have a JVM and a JS part in the shared section, so building on that I managed to solve it.

If anyone has other suggestions for different solutions or improvements to the solution below, they would still be welcome.

Here is what I did:

I've got a server, client and shared project in my build.sbt:

lazy val server = (project in file("server"))
  .settings(commonSettings)
  ... etc.

lazy val client = (project in file("client"))
  .settings(commonSettings)
  ... etc.

lazy val shared = crossProject(JSPlatform, JVMPlatform)
  .crossType(CrossType.Full)
  .in(file("shared"))
  .settings(commonSettings)
  .settings(
    libr…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by marcvk
Comment options

You must be logged in to vote
1 reply
@marcvk
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants