Book Image

Kotlin Blueprints

By : Ashish Belagali, Akshay Chordiya, Hardik Trivedi
Book Image

Kotlin Blueprints

By: Ashish Belagali, Akshay Chordiya, Hardik Trivedi

Overview of this book

Kotlin is a powerful language that has applications in a wide variety of fields. It is a concise, safe, interoperable, and tool-friendly language. The Android team has also announced first-class support for Kotlin, which is an added boost to the language. Kotlin’s growth is fueled through carefully designed business and technology benefits. The collection of projects demonstrates the versatility of the language and enables you to build standalone applications on your own. You’ll build comprehensive applications using the various features of Kotlin. Scale, performance, and high availability lie at the heart of the projects, and the lessons learned throughout this book. You’ll learn how to build a social media aggregator app that will help you efficiently track various feeds, develop a geospatial webservice with Kotlin and Spring Boot, build responsive web applications with Kotlin, build a REST API for a news feed reader, and build a server-side chat application with Kotlin. It also covers the various libraries and frameworks used in the projects. Through the course of building applications, you’ll not only get to grips with the various features of Kotlin, but you’ll also discover how to design and prototype professional-grade applications.
Table of Contents (16 chapters)
Title Page
Credits
About the Authors
Acknowledgments
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface

Developing a weather forecast web app


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:

  1. Create a Kotlin+JavaScript project named KotlinBluePrintsJSDemo.
  2. Create an index.html page under the root directory.
  3. Create a Main.kt file inside the src directory.
  4. Add script tags to add two JavaScript files, kotlin.js and KotlinBluePrintsJSDemo.js.
  5. Build a project.

We want to create an app that will look like this at the end. Entirely in Kotlin:

Creating a UI with dummy data

The very first thing we do is to create a dummy...