Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added helloworld example

  • Loading branch information...
commit f255b10a4e504cb8b47a51e129db93597c6f2902 1 parent 55704b0
TJ Holowaychuk tj authored
Showing with 12 additions and 16 deletions.
  1. +0 −16 examples/hello-world/server.js
  2. +12 −0 examples/helloworld.js
16 examples/hello-world/server.js
View
@@ -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');
12 examples/helloworld.js
View
@@ -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);
Please sign in to comment.
Something went wrong with that request. Please try again.