summaryrefslogtreecommitdiff
path: root/examples/crossBuilds/clientserver2/server
diff options
context:
space:
mode:
Diffstat (limited to 'examples/crossBuilds/clientserver2/server')
l---------examples/crossBuilds/clientserver2/server/shared1
-rw-r--r--examples/crossBuilds/clientserver2/server/src/main/scala/simple/Page.scala21
-rw-r--r--examples/crossBuilds/clientserver2/server/src/main/scala/simple/Server.scala54
3 files changed, 0 insertions, 76 deletions
diff --git a/examples/crossBuilds/clientserver2/server/shared b/examples/crossBuilds/clientserver2/server/shared
deleted file mode 120000
index f32be42..0000000
--- a/examples/crossBuilds/clientserver2/server/shared
+++ /dev/null
@@ -1 +0,0 @@
-../client/shared \ No newline at end of file
diff --git a/examples/crossBuilds/clientserver2/server/src/main/scala/simple/Page.scala b/examples/crossBuilds/clientserver2/server/src/main/scala/simple/Page.scala
deleted file mode 100644
index 9b21b5a..0000000
--- a/examples/crossBuilds/clientserver2/server/src/main/scala/simple/Page.scala
+++ /dev/null
@@ -1,21 +0,0 @@
-package simple
-import scalatags.Text.all._
-
-object Page{
- val boot =
- "simple.Client().main(document.getElementById('contents'))"
- val skeleton =
- html(
- head(
- script(src:="/client-fastopt.js"),
- link(
- rel:="stylesheet",
- href:="http://yui.yahooapis.com/pure/0.5.0/pure-min.css"
- )
- ),
- body(
- onload:=boot,
- div(id:="contents")
- )
- )
-}
diff --git a/examples/crossBuilds/clientserver2/server/src/main/scala/simple/Server.scala b/examples/crossBuilds/clientserver2/server/src/main/scala/simple/Server.scala
deleted file mode 100644
index 8967c17..0000000
--- a/examples/crossBuilds/clientserver2/server/src/main/scala/simple/Server.scala
+++ /dev/null
@@ -1,54 +0,0 @@
-package simple
-
-import akka.actor.ActorSystem
-import spray.http.{HttpEntity, MediaTypes}
-import spray.routing.SimpleRoutingApp
-import scala.concurrent.ExecutionContext.Implicits.global
-
-object Router extends autowire.Server[String, upickle.Reader, upickle.Writer]{
- def read[Result: upickle.Reader](p: String) = upickle.read[Result](p)
- def write[Result: upickle.Writer](r: Result) = upickle.write(r)
-}
-
-object Server extends SimpleRoutingApp with Api{
- def main(args: Array[String]): Unit = {
- implicit val system = ActorSystem()
- startServer("localhost", port = 8080){
- get{
- pathSingleSlash{
- complete{
- HttpEntity(
- MediaTypes.`text/html`,
- Page.skeleton.render
- )
- }
- } ~
- getFromResourceDirectory("")
- } ~
- post{
- path("ajax" / Segments){ s =>
- extract(_.request.entity.asString) { e =>
- complete {
- Router.route[Api](Server)(
- autowire.Core.Request(
- s,
- upickle.read[Map[String, String]](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