Skip to content
Browse files

Initial load

  • Loading branch information...
0 parents commit 61df2669529c0413ffa34a119102e3121b3bd728 @eee-c committed Jun 21, 2011
Showing with 110 additions and 0 deletions.
  1. +1 −0 .gitignore
  2. +25 −0 express.js
  3. +1 −0 index.js
  4. +17 −0 package.json
  5. +66 −0 spdy.js
1 .gitignore
@@ -0,0 +1 @@
+node_modules
25 express.js
@@ -0,0 +1,25 @@
+var express = require('express')
+ , expressCreateServer = express.createServer
+ , SPDYServer = require('./spdy');
+
+var exports = module.exports = express;
+
+exports.createServer = function(options){
+ if ('object' == typeof options) {
+ return new SPDYServer(options, Array.prototype.slice.call(arguments, 1));
+ } else {
+ return expressCreateServer(Array.prototype.slice.call(arguments));
+ }
+};
+
+exports.SPDYServer = SPDYServer;
+
+var http = require('http')
+ , res = http.ServerResponse.prototype
+ , spdy = require('../../../lib/spdy')
+ , spdy_res = spdy.Response.prototype;
+
+// TODO: other methods?
+spdy_res.send = res.send;
+spdy_res.header = res.header;
+spdy_res.contentType = res.contentType;
1 index.js
@@ -0,0 +1 @@
+module.exports = require('./express.js');
17 package.json
@@ -0,0 +1,17 @@
+{
+ "author": "Chris Strom <chris@eeecomputes.com> (http://eeecomputes.com)",
+ "name": "express-spdy",
+ "description": "SPDY-ize express.js sites.",
+ "version": "0.0.0",
+ "homepage": "https://github.com/eee-c/express-spdy",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/eee-c/express-spdy.git"
+ },
+ "main": "index.js",
+ "engines": {
+ "node": "~v0.5.0-pre"
+ },
+ "dependencies": {},
+ "devDependencies": {}
+}
66 spdy.js
@@ -0,0 +1,66 @@
+
+/*!
+ * Express - SPDYServer
+ * Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var connect = require('connect-spdy')
+ , HTTPServer = require('./http')
+ , spdy = require('spdy')
+ , spdy_res = spdy.Response.prototype
+ , http = require('http')
+ , res = http.ServerResponse.prototype;
+
+/**
+ * Expose `SPDYServer`.
+ */
+
+exports = module.exports = SPDYServer;
+
+/**
+ * Server proto.
+ */
+
+var app = SPDYServer.prototype;
+
+/**
+ * Initialize a new `SPDYServer` with the
+ * given `options`, and optional `middleware`.
+ *
+ * @param {Object} options
+ * @param {Array} middleware
+ * @api public
+ */
+
+function SPDYServer(options, middleware){
+ connect.SPDYServer.call(this, options, []);
+ this.init(middleware);
+};
+
+/**
+ * Inherit from `connect.SPDYServer`.
+ */
+
+app.__proto__ = connect.SPDYServer.prototype;
+
+// mixin HTTPServer methods
+
+Object.keys(HTTPServer.prototype).forEach(function(method){
+ app[method] = HTTPServer.prototype[method];
+});
+
+// TODO: don't hard-code which methods get mixed-in
+spdy_res.partial = res.partial;
+spdy_res.render = res.render;
+spdy_res._render = res._render;
+
+// TODO: mixin
+// spdy_res.send = res.send;
+// spdy_res.header = res.header;
+// spdy_res.contentType = res.contentType;
+// ...

0 comments on commit 61df266

Please sign in to comment.
Something went wrong with that request. Please try again.