blob: 36947ffcd4d5f68a41915094f765484ff14fce81 [file]
package express
import kotlinx.coroutines.*
import kotlinx.coroutines.channels.*
@JsModule("express")
external fun express(): dynamic
val app = express()
@ExperimentalCoroutinesApi
fun main(args: Array<String>) {
val scope = CoroutineScope(Dispatchers.Default)
// register the routes.
val hitCountChannel = routes(app)
scope.launch {
hitCountChannel.consumeEach {
println("Hits so far: $it")
}
}
app.listen(3000, {
println("Listening on port 3000")
})
}