Permalink
Browse files

Add new very-barebones demo app. Unlike the wiki, this doesn't even u…

…se a DB.
  • Loading branch information...
j4cbo committed Aug 30, 2010
1 parent a5ff83e commit 571329ba6c0437660076876f4cfb9df8d2a96c91
Showing with 72 additions and 0 deletions.
  1. +1 −0 barebones/.gitignore
  2. +11 −0 barebones/chiral.sml
  3. +1 −0 barebones/main.sml
  4. +13 −0 barebones/test.cm
  5. +14 −0 barebones/test.mlb
  6. +32 −0 barebones/test.sml
View
@@ -0,0 +1 @@
+.cm
View
@@ -0,0 +1,11 @@
+structure TH = Thread (structure T = ThreadBase
+ structure RC = SelectReactorCore
+ structure C = ConfigPrintEverything)
+
+structure CV = CondVar(TH)
+structure CS = ChiralSocketFn(TH)
+structure SU = ChiralSockUtil(CS)
+structure LR = LineReader(CS.Socket)
+
+structure CHTTPServer = HTTPServerFn(structure CS = CS structure T = TH)
+
View
@@ -0,0 +1 @@
+val _ = Test.main ()
View
@@ -0,0 +1,13 @@
+Group is
+ $/basis.cm
+ $/regexp-lib.cm
+
+ ../web/web.cm
+
+ ../chiralml/chiralml.cm
+ ../web/server/http-server-fn.sml
+ chiral.sml
+
+ ../chiralml/introspector/introspector.cm
+
+ test.sml
View
@@ -0,0 +1,14 @@
+$(SML_LIB)/basis/basis.mlb
+
+../smelt/tinyxml/tinyxml.mlb
+../web/web.mlb
+
+../chiralml/chiralml.mlb
+../web/server/http-server-fn.sml
+chiral.sml
+
+../chiralml/introspector/thread-list.html.sml
+../chiralml/introspector/introspector.sml
+
+test.sml
+main.sml
View
@@ -0,0 +1,32 @@
+structure Test = struct
+
+ structure U = WebUtil
+
+ structure I = Introspector(structure T = TH)
+
+ fun handler (req: Web.request) = (case U.postpath req of
+
+ nil => U.resp "text/plain" "lol"
+ | [ "" ] => U.resp "text/plain" "lol"
+
+ | [ "introspector", "" ] => I.app req
+
+ | _ => raise U.notFound
+ )
+
+ val app = U.dumpRequestWrapper print (U.exnWrapper handler)
+
+ fun main _ = let
+ val () = print "Listening...\n"
+ val serverthread = CHTTPServer.spawn_server (INetSock.any 5124) app
+ in
+ TH.run ();
+ 0
+ end
+
+end
+
+
+structure FHandler = HTTPHandlerFn(structure S = CS.Socket val can_keep_alive = true val server_name = "f")
+
+val s = HTTPServer.serve

0 comments on commit 571329b

Please sign in to comment.