Last active
September 10, 2019 14:49
-
-
Save susliko/ab5bc259b76b0de1bbc78d88054de129 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import akka.actor.ActorSystem | |
import akka.http.scaladsl.Http | |
import akka.stream.{ActorMaterializer, Materializer} | |
import korolev._ | |
import korolev.akkahttp._ | |
import korolev.execution._ | |
import korolev.server._ | |
import korolev.state.javaSerialization._ | |
import scala.concurrent.Future | |
object Main extends App { | |
private implicit val actorSystem: ActorSystem = ActorSystem() | |
private implicit val materializer: Materializer = ActorMaterializer() | |
val applicationContext = Context[Future, Boolean, Any] | |
import applicationContext._ | |
import symbolDsl._ | |
private val config = KorolevServiceConfig[Future, Boolean, Any]( | |
stateStorage = StateStorage.default(false), | |
router = Router.empty, | |
render = { case _ => | |
'section ( | |
List( | |
'section ('button ('type /= "submit", event('click) { _ => | |
Future(println(1)) | |
})), | |
'section ('button ('type /= "submit", event('click) { _ => | |
Future(println(2)) | |
})) | |
)) | |
} | |
) | |
private val route = akkaHttpService(config).apply(AkkaHttpServerConfig()) | |
Http().bindAndHandle(route, "0.0.0.0", 8080) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment