Skip to content
Advertisement

call/run function from Kotlin with Nodejs

I’ve wrote some lines of code in Kotlin now i want to execute this function from Javascrip or Nodejs is that possible? I only find solution for calling JS functions but not for calling Kotlin functions

for example: JS:

function callKotlinHelloWorld(){
  //excute stuff
}

Kotlin:

fun HelloWorld(){
  println("Hello World")
}

I heared from Kotlin/JS but there are some difrents from the normal JS and Kotlin

Thanks for helping

Advertisement

Answer

You might want to have a look at https://kotlinlang.org/docs/js-overview.html.

Edit:

The Node.js target provided by Kotlin/JS enables you to create applications that run on a server or are executed on serverless infrastructure. This gives you all the advantages of executing in a JavaScript runtime, such as faster startup and a reduced memory footprint. With kotlinx-nodejs, you have typesafe access to the Node.js API directly from your Kotlin code.

As per the corresponding section in the documentation

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement