   return (req, res, next) ->
     bodyParser req, res, ->
 
-      # Respond to any requests to the sample q.py/q.php/q.jsp endpoints
-      # by grabbing the "q" or "p" parameters and interacting with the Daemon.
-      # TODO: implement as "special" URLs, and offer JS from here
-      # /__mobwrite__/sync (POST)
-      # /__mobwrite__/client.js (GET)
-      # /__mobwrite__/forms.js (GET)
-      if MOBWRITE_SAMPLE_ENDPOINT_PATTERN.test(req.url) or rootPattern.test(req.url)
+      # Respond to requests for the "mobwrite.js" file.
+      rootPath = rootPattern.exec(req.url)?[1]
+      if rootPath is "mobwrite.js"
+        res.writeHead(200, {"Content-Type": "text/javascript"})
+        res.end(clientJavascript)
+
+      # Respond to any requests to the sync endpoint (or to the typical
+      # mobwrite sample code q.py/q.php/q.jsp endpoints) by grabbing the
+      # "q" (AJAX) or "p" (JSONP) parameters and forwarding them to the Daemon.
+      else if rootPath is "sync" or MOBWRITE_SAMPLE_ENDPOINT_PATTERN.test(req.url)
         clientNeedsJsonp = req.query.p?
         daemonRequest = req.body?.q or req.query.p or "\n"
         daemonResponse = ""

DAEMON_TIMEOUT_IN_MILLISECONDS = 10*1000
DEFAULT_DAEMON_HOST = "localhost"
DEFAULT_DAEMON_PORT = 3017

serve = (options) ->
  port = options?.port or DEFAULT_DAEMON_PORT

              font-family: sans-serif;
          }
      </style>
      <script src="/mobwrite/mobwrite.js"></script>
      </head>
      <body>
          <form id="mobwrite-form" action="" method="post" accept-charset="utf-8">
