It was fun writing Kotlin code for a browser and see it working, wasn't it? Now we should target bigger goals. Let's develop another app step by step. We will build a weather forecast app, where the user will enter a ZIP code and can see the weather details (seven day forecast) for the provided region. We will use the OpenWeatherMap API to get the weather details. Please find more details at https://openweathermap.org/api.
Before we move to the next step we should create a new project named KotlinBluePrintsJSDemo.
Some quick steps to follow:
- Create a Kotlin+JavaScript project named
KotlinBluePrintsJSDemo
. - Create an
index.html
page under the root directory. - Create a
Main.kt
file inside thesrc
directory. - Add script tags to add two JavaScript files,
kotlin.js
andKotlinBluePrintsJSDemo.js
. - Build a project.
We want to create an app that will look like this at the end. Entirely in Kotlin: