Functions defined in Kotlin companion objects are often seen as the 'equivalent' of static methods in Java.
Although there are some similarities, there are also some caveats you should be aware of.
For example, how to use method references (or, to be pedantic: function references) to refer to functions
defined in a companion object.
Continue reading →
In this post I suggest a way to publish your backend API typings as an NPM package. Frontend projects using can then depend on these typings to gain compile time type safety and code completion when using Typescript.
It’s quite common in a microservice style architecture to provide a type-safe client library that other services can use to communicate with your service. This can be package with a Retrofit client published to nexus by the maintainer of the service. Some projects might also generate that code from a OpenAPI spec or a gRPC proto file.
However, when we expose some of these APIs to the frontend, we lose the types. In this post I suggest a way to publish your backend API types as an NPM package. The frontend can then depend on these typings. Using typescript you now have compile time type safety and code completion. To see a sneak peak, scroll to the end :).
Continue reading →
Micronaut makes it possible to easily configure your application using the provided mechanisms based on Spring and Grails.
This blog demonstrates how to configure a Kotlin based Micronaut application using Micronaut version 1.0.0.RC1.
First we create a Micronaut application featuring Kotlin:
After that we create our DemoController:
Continue reading →