Permalink
Browse files

add 'hello, world' application

git-svn-id: http://stilts.j4cbo.com/svn/trunk@145 0e20359e-2163-43f9-affa-fa36fe899960
  • Loading branch information...
jacob
jacob committed Jan 12, 2010
1 parent 8a1d78f commit 4af125d9cd98926fd25947ae359345b38c217cb1
Showing with 87 additions and 0 deletions.
  1. +12 −0 hello/hello.cm
  2. +6 −0 hello/hello.mlb
  3. +29 −0 hello/hello.sml
  4. +24 −0 hello/lighttpd.conf
  5. +1 −0 hello/main.sml
  6. +10 −0 hello/templates/hello.html
  7. +5 −0 hello/templates/templates.cm
View
@@ -0,0 +1,12 @@
+Group is
+ $/basis.cm
+ $/regexp-lib.cm
+
+ ../db/libmysqlclient/libmysqlclient.cm
+ ../db/squall/squall-tool.cm : tool
+ wiki.squall
+
+ ../web/web.cm
+
+ templates/templates.cm
+ wiki.sml
View
@@ -0,0 +1,6 @@
+$(SML_LIB)/basis/basis.mlb
+../smelt/tinyxml/tinyxml.mlb
+../web/web.mlb
+templates/hello.html.sml
+hello.sml
+main.sml
View
@@ -0,0 +1,29 @@
+structure Hello = struct
+
+ structure U = WebUtil
+
+ fun handler (req: Web.request) = (case U.postpath req of
+
+ nil =>
+ raise U.redirectPostpath req [ "hello" ]
+
+ | [ "" ] =>
+ raise U.redirectPostpath req [ "hello" ]
+
+ | [ "hello" ] => U.htmlResp (
+ THello.render { blort = "world" }
+ )
+
+ | _ => raise U.notFound
+ )
+
+ val app = U.dumpRequestWrapper print (U.exnWrapper handler)
+
+ fun main _ = let
+ val () = print "Listening...\n"
+ val () = HTTPServer.serve (INetSock.any 8888) app
+ in
+ 0
+ end
+
+end
View
@@ -0,0 +1,24 @@
+server.modules = ( "mod_access",
+ "mod_fastcgi",
+ "mod_accesslog",
+ "mod_rewrite",
+ "mod_staticfile" )
+
+server.document-root = "/Library/WebServer/Documents"
+server.event-handler = "freebsd-kqueue" # on Mac OS X or FreeBSD
+
+# server.errorlog = "/tmp/lighttpd.error.log"
+accesslog.filename = "/tmp/access.log"
+
+fastcgi.server = ( "" =>
+ ( "127.0.0.1" =>
+ (
+ "host" => "127.0.0.1",
+ "port" => 5124,
+ "check-local" => "disable",
+ "disable-time" => 1,
+ )
+ )
+ )
+
+server.port = 8080
View
@@ -0,0 +1 @@
+val _ = Hello.main ()
View
@@ -0,0 +1,10 @@
+<?template THello { blort } ?>
+<html>
+ <head>
+ <title>Hello, ${blort}!</title>
+ </head>
+ <body>
+ <h1>Hello, ${blort}!</h1>
+ <p>This is a simple Stilts test.</p>
+ </body>
+</html>
@@ -0,0 +1,5 @@
+Group is
+ $/basis.cm
+ ../../smelt/smelt-tool.cm : tool
+ ../../web/web.cm
+ hello.html

0 comments on commit 4af125d

Please sign in to comment.