Skip to content

Commit

Permalink
added a web hello world eample using mochiweb and simplebridge
Browse files Browse the repository at this point in the history
  • Loading branch information
marianoguerra committed May 9, 2010
1 parent 623c279 commit f9f45d6
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions examples/hello.ifn
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# see: http://efene.tumblr.com/post/582917490/web-hello-world-with-mochiweb-and-simplebridge-in

@public
start = fn ()
Options = [(ip, "127.0.0.1"), (port, 8000)]
Loop = fn loop:1
mochiweb_http.start([(name, mochiweb_example_app), (loop, Loop) : Options])

response = fn (Req, Root)
simple_bridge.make_response(mochiweb_response_bridge, (Req, Root))

response_ok = fn (Req, Root, ContentType, Data)
Response = response(Req, Root)
Response1 = Response.status_code(200)
Response2 = Response1.header("Content-Type", ContentType)
Response3 = Response2.data(Data)
Response3.build_response()

@public
loop = fn (Req)
HTML = ["<h1>Hello, World!</h1>"]
response_ok(Req, "./wwwroot", "text/html", HTML)

0 comments on commit f9f45d6

Please sign in to comment.