{"id":19411192,"url":"https://github.com/wojta/kotlin-nodejs-experiment","last_synced_at":"2025-04-24T10:33:09.430Z","repository":{"id":46732143,"uuid":"56573152","full_name":"wojta/kotlin-nodejs-experiment","owner":"wojta","description":"Demo of using  Kotlin with Node.js","archived":false,"fork":false,"pushed_at":"2017-03-20T15:18:59.000Z","size":558,"stargazers_count":20,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2023-08-01T09:29:27.585Z","etag":null,"topics":["express","kotlin","nodejs"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wojta.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-04-19T07:07:11.000Z","updated_at":"2023-08-01T09:29:27.586Z","dependencies_parsed_at":"2022-07-26T13:48:05.561Z","dependency_job_id":null,"html_url":"https://github.com/wojta/kotlin-nodejs-experiment","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wojta%2Fkotlin-nodejs-experiment","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wojta%2Fkotlin-nodejs-experiment/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wojta%2Fkotlin-nodejs-experiment/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wojta%2Fkotlin-nodejs-experiment/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wojta","download_url":"https://codeload.github.com/wojta/kotlin-nodejs-experiment/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223949529,"owners_count":17230312,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["express","kotlin","nodejs"],"created_at":"2024-11-10T12:19:30.109Z","updated_at":"2024-11-10T12:19:30.675Z","avatar_url":"https://github.com/wojta.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Demo of using  Kotlin with Node.js\nIt's a little demo using Kotlin with Node.js. It uses Gradle as a build tool.\n\n## What is Kotlin?\n[![Kotlin](https://upload.wikimedia.org/wikipedia/commons/b/b5/Kotlin-logo.png)\notlin](http://kotlinlang.org) is a programming language developed by [Jetbrains](https://www.jetbrains.com/). It's fully compatibile with [Java](http://www.java.com) runtimes and also there is (currently experimental) support for [JavaScript](https://en.wikipedia.org/wiki/JavaScript) transpilation. \n\n## What is it doing?\n* It only has two pages - index and `/kotlin_demo`\n* `/kotlin_demo` shows list of files in current directory by using calls from [Demo](demo_kotlin/src/main/kotlin/cz/sazel/demo_kotlin/Demo.kt) class\n\n## Structure\n* ``demo_kotlin`` - module with Kotlin code\n* ``express_js`` - module with basic Node.js Express app\n* ``express_js/compiled`` - transpiled .js files and Kotlin standard library (in ``lib``)\n* ``express_js/bin`` - place for server's startup scripts\n\n## How it works?\nTranspiler does the transpilation to [JavaScript](https://en.wikipedia.org/wiki/JavaScript). Product of this process is file ``demo_kotlin.js``. Also you have base Kotlin JavaScript library ``kotlin.js`` that contains standard library and all support functions. JavaScript files are copyied by Gradle script to ``compiled`` directory in ``express_js`` module and after that you can use them from JavaScript.\n\nKotlin Gradle plugin handles building Node.js compatibile modules (CommonJS) by adding parameter\n \n `kotlinOptions.moduleKind = \"commonjs\"`\n\n## Accessing Kotlin class from JavaScript\n\nCheck [express_js/route/kotlin.js](express_js/route/kotlin.js)\n\n`var Demo=require(\"../compiled/demo_kotlin\").cz.sazel.demo_kotlin.Demo;`\n\n\n## Install and strartup\n* You'll need [Node.js](https://nodejs.org/en/) (probably version \u003e=5) installed in your system.  \n* If you used previous version of this experiment, please run `:demo_kotlin:clean` Gradle task.\n* Do `./gradlew build`\n* Do `./gradlew :express_js:npmInstall` or `npm install` in *express_js* directory\n* Start server by starting `express_js/bin/www` and go to page [http://localhost:3000/kotlin_demo](http://localhost:3000/kotlin_demo) \n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwojta%2Fkotlin-nodejs-experiment","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwojta%2Fkotlin-nodejs-experiment","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwojta%2Fkotlin-nodejs-experiment/lists"}