https://kotlinlang.org logo
#ktor
Title
# ktor
i

ivano

12/01/2019, 12:55 PM
My question is how can I use Vuejs instead of Freemarker?
r

r4zzz4k

12/01/2019, 4:46 PM
Depends on how are you using Vue.js. Are you doing Kotlin/JS with it, so that webpack is run by Gradle, or is it external to your Gradle project containing backend code? For the first one you'll have to configure dependencies on two subprojects, so that building backend causes building frontend first, and then you collect built JS files to serve them when server is launched. You should have something similar to this: https://kotlinlang.slack.com/archives/C0B8L3U69/p1575051416301000?thread_ts=1575048475.300900&cid=C0B8L3U69 Unfortunately no out-of-the-box solution which I'm aware of. If your Vue.js app is completely separate, just grab built frontend manually and put it into resources of your backend app or somewhere in the filesystem where backend would run, depending on your use case. After you make your frontend files available to backend, simply serve them as static content. https://ktor.io/servers/features/static-content.html
i

ivano

12/03/2019, 12:36 PM
thank you for the very complete response
I would like to run in the gradle package as with freemarker
a library will come soonish if ktor get traction\
e

Evan R.

12/03/2019, 3:24 PM
Also VueJS is just a frontend javascript framework. While it can do server-side-rendering, there is currently no Ktor feature that will render Vue as Vue’s SSR library is built for Node.js It might be easier to just serve the static content like Andrew was suggesting
67 Views