Created
September 10, 2019 14:51
-
-
Save susliko/1a576712543dbe3bb8ea82d81810b376 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(1, 2).map { el => | |
'section ('button ('type /= "submit", event('click) { _ => | |
Future(println(el)) | |
})) | |
}) | |
} | |
) | |
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