Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1354)

Unified Diff: frog/samples/node/httpServer.dart

Issue 9034014: Add support for the node net module. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: new version of minfrog Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: frog/samples/node/httpServer.dart
===================================================================
--- frog/samples/node/httpServer.dart (revision 0)
+++ frog/samples/node/httpServer.dart (revision 0)
@@ -0,0 +1,14 @@
+#library('httpServer');
+
+#import('../../lib/node/node.dart');
+#import('../../lib/node/http.dart');
+
+void main() {
+ // Note: the callback function must use the actual types for the arguments,
+ // otherwise frog will strip out the type's methods.
+ http.createServer((ServerRequest req, ServerResponse res) {
+ res.writeHead(200, '', {'Content-Type': 'text/plain'});
+ res.end('Hello World\n');
+ }).listen(1337, "127.0.0.1");
+ console.log('Server running at http://127.0.0.1:1337/');
+}

Powered by Google App Engine
This is Rietveld 408576698