Let's create a simple cloud function that accepts a string value and returns it.
Create a Main.kt file with the following code inside:
external fun require(module: String): dynamicexternal val exports: dynamicfun main(args: Array<String>) { val functions = require("firebase-functions") val admin = require("firebase-admin") admin.initializeApp(functions.config().firebase) exports.echoString = functions.https.onRequest { req, res -> val text = req.query.text res.status(200).send("Echo : $text") }}
The dynamic keyword has a meaning. Kotlin is statically-typed, but because of interoperability features, it still has to deal with untyped or loosely-typed languages and environments. This allows you to call any property ...