summaryrefslogtreecommitdiff
path: root/examples/crossBuilds/clientserver/server/src/main/scala/simple/Server.scala
diff options
context:
space:
mode:
Diffstat (limited to 'examples/crossBuilds/clientserver/server/src/main/scala/simple/Server.scala')
-rw-r--r--examples/crossBuilds/clientserver/server/src/main/scala/simple/Server.scala46
1 files changed, 0 insertions, 46 deletions
diff --git a/examples/crossBuilds/clientserver/server/src/main/scala/simple/Server.scala b/examples/crossBuilds/clientserver/server/src/main/scala/simple/Server.scala
deleted file mode 100644
index e9038b5..0000000
--- a/examples/crossBuilds/clientserver/server/src/main/scala/simple/Server.scala
+++ /dev/null
@@ -1,46 +0,0 @@
-package simple
-
-import akka.actor.ActorSystem
-import spray.http.{HttpEntity, MediaTypes}
-import spray.routing.SimpleRoutingApp
-
-import scala.util.Properties
-
-object Server extends SimpleRoutingApp{
- def main(args: Array[String]): Unit = {
- implicit val system = ActorSystem()
- val port = Properties.envOrElse("PORT", "8080").toInt
- startServer("0.0.0.0", port = port){
- get{
- pathSingleSlash{
- complete{
- HttpEntity(
- MediaTypes.`text/html`,
- Page.skeleton.render
- )
- }
- } ~
- getFromResourceDirectory("")
- } ~
- post{
- path("ajax" / "list"){
- extract(_.request.entity.asString) { e =>
- complete {
- upickle.write(list(e))
- }
- }
- }
- }
- }
- }
- def list(path: String) = {
- val (dir, last) = path.splitAt(path.lastIndexOf("/") + 1)
- val files =
- Option(new java.io.File("./" + dir).listFiles())
- .toSeq.flatten
- for{
- f <- files
- if f.getName.startsWith(last)
- } yield FileData(f.getName, f.length())
- }
-} \ No newline at end of file