commit 61a346273091d9404ffd15f2804feb2b0b3abd97
parent 50f5d07780c259037edf915abf727986b29837c7
Author: MTRNord <mtrnord1@gmail.com>
Date: Thu, 8 Feb 2018 19:53:50 +0100
Remove Webserver to later replace it with a Golang Server (as it is just more simple than doing it in Scala)
Signed-off-by: MTRNord <mtrnord1@gmail.com>
Diffstat:
2 files changed, 0 insertions(+), 50 deletions(-)
diff --git a/src/main/scala/Main.scala b/src/main/scala/Main.scala
@@ -71,8 +71,6 @@ object Main extends App with StrictLogging {
/*val test = new GenerateNewsPaper
test.execute(null)*/
- webServer.WebServer.main()
-
generator.Scheduler.main()
case Failure(err) => logger.error(err.toString)
}
diff --git a/src/main/scala/webServer/WebServer.scala b/src/main/scala/webServer/WebServer.scala
@@ -1,48 +0,0 @@
-package webServer
-
-import akka.actor.ActorSystem
-import akka.http.scaladsl.Http
-import akka.http.scaladsl.model.HttpMethods._
-import akka.http.scaladsl.model._
-import akka.stream.ActorMaterializer
-import com.typesafe.scalalogging.StrictLogging
-
-import scala.concurrent.ExecutionContextExecutor
-
-object WebServer extends StrictLogging {
- def main() {
-
- implicit val system: ActorSystem = ActorSystem("FreifunkNews")
- implicit val materializer: ActorMaterializer = ActorMaterializer()
- // needed for the future flatMap/onComplete in the end
- implicit val executionContext: ExecutionContextExecutor = system.dispatcher
-
- val requestHandler: HttpRequest => HttpResponse = {
- case HttpRequest(GET, Uri.Path("/"), _, _, _) =>
- HttpResponse(
- entity = HttpEntity(
- ContentTypes.`text/html(UTF-8)`,
- "<html><body>Hello world!</body></html>"
- )
- )
-
- case HttpRequest(GET, Uri.Path("/ping"), _, _, _) =>
- HttpResponse(entity = "PONG!")
-
- case HttpRequest(GET, Uri.Path("/crash"), _, _, _) =>
- sys.error("BOOM!")
-
- case r: HttpRequest =>
- r.discardEntityBytes() // important to drain incoming HTTP Entity stream
- HttpResponse(404, entity = "Unknown resource!")
- }
-
- val bindingFuture =
- Http().bindAndHandleSync(requestHandler, "localhost", 8080)
-
- logger.info(s"Server online at http://localhost:8080/")
- bindingFuture
- .flatMap(_.unbind()) // trigger unbinding from the port
- .onComplete(_ => system.terminate()) // and shutdown when done
- }
-}