Skip to content

patricia-gallardo/hello_kotlin_js

Repository files navigation

Kotlin/JS Hello World project

The basic idea is to provide a project that builds and runs, while also showing how the various pieces can interact.

The main function of this project is

fun main() {
    // commonMain type (pure Kotlin)
    val hello = Hello()

    // jsMain type (Kotlin code that interfaces with Node)
    val someObject = KotlinClassInJsMain()

    // Use them together (JsMain type prints string from pure Kotlin to the console)
    someObject.console(hello.sayHello())

    // Call out to a node lib (axios) to query an API
    someObject.demoCallingANodeLib()
}

Which can be found in src/jsMain/kotlin/App.kt

To run app

./gradlew jsNodeRun

Which produces the output

> Task :jsNodeRun
Hello, Kotlin/JS!
ZipResult for 87701 was : ZipResult(country=US, state=NM, city=LAS VEGAS)

To run continuously

./gradlew jsNodeRun --continuous

To run the tests

./gradlew cleanAllTests jsNodeTest

Which produces the output

> Task :jsNodeTest
  0 passing (2ms)
HelloTest   : SUCCESS
AppTest     : SUCCESS
TEST RESULT : SUCCESS
BUILD SUCCESSFUL in 1s

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages