Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update multiplatform-full-stack-app.md during the version updates #3764

Merged
merged 1 commit into from
Oct 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions docs/topics/multiplatform/multiplatform-full-stack-app.md
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ Whenever you run the server with the `run` Gradle task, the frontend is also bui
artifacts. To learn more about how this works, see the [Relevant Gradle configuration](#relevant-gradle-configuration-for-the-frontend)
section.

The template already comes with a boilerplate `index.html` file in the `src/commonMain/resources` folder. It has
The template already comes with a boilerplate `index.html` file in the `src/commonMain/resources/static` folder. It has
a `root` node for rendering components and a `script` tag that includes the application:

```xml
Expand Down Expand Up @@ -448,8 +448,9 @@ tasks.getByName<Jar>("jvmJar") {
"jsBrowserDevelopmentWebpack"
}
val webpackTask = tasks.getByName<KotlinWebpack>(taskName)
dependsOn(webpackTask) // make sure JS gets compiled first
from(File(webpackTask.destinationDirectory, webpackTask.outputFileName)) // bring output file along into the JAR
dependsOn(webpackTask)
from(webpackTask.map { it.mainOutputFile.get().asFile }) // bring output file along into the JAR
into("static")
}
```

Expand All @@ -474,12 +475,6 @@ root directory.
1. In `src/jvmMain/kotlin/Server.kt`, add the corresponding routes to the `routing` block:

```kotlin
get("/") {
call.respondText(
this::class.java.classLoader.getResource("index.html")!!.readText(),
ContentType.Text.Html
)
}
staticResources("/", "static")
route(ShoppingListItem.path) {
// ...
Expand Down
Loading