summaryrefslogtreecommitdiff
path: root/book/src/main/scalatex/book/handson
diff options
context:
space:
mode:
authorLi Haoyi <haoyi@dropbox.com>2014-11-10 20:49:32 -0800
committerLi Haoyi <haoyi@dropbox.com>2014-11-10 20:49:32 -0800
commit916476a310661a0b81011e0af429f356d5cd36e7 (patch)
treeae0515e87b30681dd291bd78276a8f2edb6e1a4e /book/src/main/scalatex/book/handson
parentaaea4afbf3b47d623f396cb1eae247fa92053032 (diff)
downloadhands-on-scala-js-916476a310661a0b81011e0af429f356d5cd36e7.tar.gz
hands-on-scala-js-916476a310661a0b81011e0af429f356d5cd36e7.tar.bz2
hands-on-scala-js-916476a310661a0b81011e0af429f356d5cd36e7.zip
Small cleanup, book is now acyclic
Diffstat (limited to 'book/src/main/scalatex/book/handson')
-rw-r--r--book/src/main/scalatex/book/handson/ClientServer.scalatex21
-rw-r--r--book/src/main/scalatex/book/handson/PublishingModules.scalatex21
2 files changed, 23 insertions, 19 deletions
diff --git a/book/src/main/scalatex/book/handson/ClientServer.scalatex b/book/src/main/scalatex/book/handson/ClientServer.scalatex
index b29df03..817f568 100644
--- a/book/src/main/scalatex/book/handson/ClientServer.scalatex
+++ b/book/src/main/scalatex/book/handson/ClientServer.scalatex
@@ -15,7 +15,22 @@
@sect{A Client-Server Setup}
@p
- Getting started with client-server integration, let's go with the simplest configuration possible: a Spray server and a Scala.js client. Most of the other web-frameworks (Play, Scalatra, etc.) will have more complex configurations, but the basic mechanism of wiring up Scala.js to your web framework will be the same.
+ Getting started with client-server integration, let's go with the simplest configuration possible: a Spray server and a Scala.js client. Most of the other web-frameworks (Play, Scalatra, etc.) will have more complex configurations, but the basic mechanism of wiring up Scala.js to your web framework will be the same. Our project will look like this:
+
+ @hl.bash
+ $ tree
+ .
+ ├── build.sbt
+ ├── client
+ │   ├── shared/main/scala/simple/FileData.scala
+ │   └── src/main/scala/simple/Client.scala
+ ├── project
+ │   └── build.sbt
+ └── server
+ ├── shared -> ../client/shared
+ └── src/main/scala/simple
+ ├── Page.scala
+ └── Server.scala
@p
First, let's do the wiring in @code{build.sbt}:
@@ -94,4 +109,6 @@
@li
Try adding additional functionality to the client-server interface: what about making it show the contents of a file if you've entered its full path? This can be added as a separate Ajax call or as part of the existing one.
@li
- How about setting up the build.sbt so it serves the fully-optimized Scala.js blob, @code{client-opt.js}? This is probably what you want before deployment into production, and the same technique as we used to serve the fast-optimized version applies here too. \ No newline at end of file
+ How about setting up the build.sbt so it serves the fully-optimized Scala.js blob, @code{client-opt.js}? This is probably what you want before deployment into production, and the same technique as we used to serve the fast-optimized version applies here too.
+ @li
+ What if you wanted to use another server rather than Spray? How about trying to set up a Play or Scalatra server to serve our Scala.js application code? \ No newline at end of file
diff --git a/book/src/main/scalatex/book/handson/PublishingModules.scalatex b/book/src/main/scalatex/book/handson/PublishingModules.scalatex
index 7882283..b329966 100644
--- a/book/src/main/scalatex/book/handson/PublishingModules.scalatex
+++ b/book/src/main/scalatex/book/handson/PublishingModules.scalatex
@@ -15,25 +15,12 @@
.
├── build.sbt
├── js
- │   ├── shared
- │   │   └── main
- │   │   └── scala
- │   │   └── simple
- │   │   └── Simple.scala
- │   └── src
- │   └── main
- │   └── scala
- │   └── simple
- │   └── Platform.scala
+ │   ├── shared/main/scala/simple/Simple.scala
+ │   └── src/main/scala/simple/Platform.scala
├── jvm
│   ├── shared -> ../js/shared
- │   └── src
- │   └── main
- │   └── scala
- │   └── simple
- │   └── Platform.scala
- └── project
- └── build.sbt
+ │   └── src/main/scala/simple/Platform.scala
+ └── project/ build.sbt
@p
In this case the two @code{shared/} folders are symlinked together to keep them in sync. This can be done by first creating @code{js/shared}, and then running