Home > OS >  call/run function from Kotlin with Nodejs
call/run function from Kotlin with Nodejs

Time:02-18

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

CodePudding user response:

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

  • Related