This is a simple project that uses Kotlin/WASM interop to create a simple HTML page that allows the user to open a text file on their machine and edit it with the Monaco editor. The project uses a RPC-based HTTP server to faciliate file reading and writing, as no pure-RPC library that supported Kotlin/WASM could be found.
The server has two routes:
POST /file.open
to open files, returning file contents given a pathPOST /file.save
to save files, being provided the path to a file and its new contents
- In one terminal, run
./gradlew runFatJar
to start the server (runs on port 9090) - In another terminal, run
./gradlew wasmJsBrowserDevelopmentRun
to start the webpack dev server (runs on port 8080) - Navigate to
localhost:8080
in your browser - the UI will then pop up. - Enter the absolute path to a file on your machine in the text box and click "Open"
- The file will be opened in the Monaco editor. Edit it as you wish, and click "Save" to save the file.