Permalink
Browse files

Added helloworld example

  • Loading branch information...
1 parent 55704b0 commit f255b10a4e504cb8b47a51e129db93597c6f2902 @tj tj committed Feb 23, 2011
Showing with 12 additions and 16 deletions.
  1. +0 −16 examples/hello-world/server.js
  2. +12 −0 examples/helloworld.js
View
16 examples/hello-world/server.js
@@ -1,16 +0,0 @@
-// Note that even though this looks like a normal node http app, it's really a
-// valid connect app using the connect middleware stack.
-
-var connect = require('../../lib/connect');
-
-var server = connect.createServer(function(req, res){
- var body = 'Hello World';
- res.writeHead(200, {
- 'Content-Type': 'text/plain'
- , 'Content-Length': body.length
- });
- res.end(body);
-});
-
-server.listen(3000);
-console.log('Connect server listening on port 3000');
View
12 examples/helloworld.js
@@ -0,0 +1,12 @@
+
+/**
+ * Module dependencies.
+ */
+
+var connect = require('../');
+
+connect.createServer(function(req, res){
+ var body = 'Hello World';
+ res.setHeader('Content-Length', body.length);
+ res.end(body);
+}).listen(3000);

0 comments on commit f255b10

Please sign in to comment.