Permalink
Browse files

Start rename of library to "dys"

  • Loading branch information...
Daniel Pupius
Daniel Pupius committed Nov 2, 2011
1 parent bfdd437 commit 61a2d9a8346b8a58486611ca417a3c959cd39de1
View
@@ -4,12 +4,12 @@
* @author dan@pupi.us (Daniel Pupius)
*/
-var dispatch = require('dispatch');
+var dys = require('dys');
-new dispatch.Server(4107, '127.0.0.1').
- addModule(new dispatch.RequestLogModule('/tmp')).
- addModule(new dispatch.StatsModule()).
- addModule(new dispatch.auth.BasicAuthModule('Basic Auth Test').
+new dys.Server(4107, '127.0.0.1').
+ addModule(new dys.RequestLogModule('/tmp')).
+ addModule(new dys.StatsModule()).
+ addModule(new dys.auth.BasicAuthModule('Basic Auth Test').
// Provide a hardcoded set of usernam/password pairs.
withUserMap({
'dan': 'dan1234',
View
@@ -9,29 +9,29 @@
* @author dan@pupi.us (Daniel Pupius)
*/
-var dispatch = require('dispatch');
+var dys = require('dys');
var connect = require('connect');
-new dispatch.Server(4103, '127.0.0.1').
+new dys.Server(4103, '127.0.0.1').
// Adds a response time header. curl -I http://localhost:4103
addConnectMiddleware(connect.responseTime()).
- // Logs each request to the console. See dispatch.RequestLogModule for
+ // Logs each request to the console. See dys.RequestLogModule for
// a utility that logs to a file rather than spamming the console.
addConnectMiddleware(connect.logger()).
- // Serves a favicon, but as noted below has limitations with 'dispatch'.
+ // Serves a favicon, but as noted below has limitations with 'dys'.
addConnectMiddleware(connect.favicon()).
// Add a simple action that serves at the root.
- addAction('/', new dispatch.SimpleAction(200, '<h1>Connect Test</h1>')).
+ addAction('/', new dys.SimpleAction(200, '<h1>Connect Test</h1>')).
// Currently, interceptors are only run for paths that match an existing
// action, this has some nice properties, but is in contrast to the connect
// model so may need changing.
// For now we need to register a catch all action and manually 404 if an
// interceptor doesn't handle the request.
- addAction('/*', new dispatch.SimpleAction(404, '<h1>Not Found</h1>')).
+ addAction('/*', new dys.SimpleAction(404, '<h1>Not Found</h1>')).
// Start up the server.
start();
View
@@ -1,17 +1,17 @@
/**
* @fileoverview Example : Cookies.
*
- * Demonstrates how to use the cookie functionality in dispatch.
+ * Demonstrates how to use the cookie functionality in dys.
*
* @author dan@pupi.us (Daniel Pupius)
*/
-var dispatch = require('dispatch');
+var dys = require('dys');
-new dispatch.Server(4109, '127.0.0.1').
- addModule(new dispatch.RequestLogModule('/tmp')).
- addModule(new dispatch.StatsModule()).
- addModule(new dispatch.CookieModule()).
+new dys.Server(4109, '127.0.0.1').
+ addModule(new dys.RequestLogModule('/tmp')).
+ addModule(new dys.StatsModule()).
+ addModule(new dys.CookieModule()).
addAction('/*', function(ctx) {
var path = ctx.get('path');
var req = ctx.get('request');
View
@@ -4,12 +4,12 @@
* @author dan@pupi.us (Daniel Pupius)
*/
-var dispatch = require('dispatch');
+var dys = require('dys');
-new dispatch.Server(4108, '127.0.0.1').
- addModule(new dispatch.RequestLogModule('/tmp')).
- addModule(new dispatch.StatsModule()).
- addModule(new dispatch.auth.DigestAuthModule('Digest Auth Test Realm').
+new dys.Server(4108, '127.0.0.1').
+ addModule(new dys.RequestLogModule('/tmp')).
+ addModule(new dys.StatsModule()).
+ addModule(new dys.auth.DigestAuthModule('Digest Auth Test Realm').
// Provide a hardcoded set of usernam/password pairs.
withUserMap({
'dan': 'dan1234',
View
@@ -11,9 +11,9 @@
* @author dan@pupi.us (Daniel Pupius)
*/
-var dispatch = require('dispatch');
+var dys = require('dys');
-new dispatch.Server(4105, '127.0.0.1').
+new dys.Server(4105, '127.0.0.1').
withCredentials(__dirname + '/privatekey.pem', __dirname + '/certificate.pem').
addAction('/', function(ctx) {
var req = ctx.get('request');
View
@@ -13,12 +13,12 @@
* @author dan@pupi.us (Daniel Pupius)
*/
-var dispatch = require('dispatch');
+var dys = require('dys');
-new dispatch.Server(4101, '127.0.0.1').
- addModule(new dispatch.RequestLogModule('/tmp')).
- addModule(new dispatch.StatsModule()).
- addModule(new dispatch.StaticFileModule({reStatTime: 2}).
+new dys.Server(4101, '127.0.0.1').
+ addModule(new dys.RequestLogModule('/tmp')).
+ addModule(new dys.StatsModule()).
+ addModule(new dys.StaticFileModule({reStatTime: 2}).
serveFiles('/images/*', __dirname + '/images', {
// Only allow certain image files.
filter: /\.(jpg|gif|png)$/,
@@ -27,5 +27,5 @@ new dispatch.Server(4101, '127.0.0.1').
cacheLifetime: 5,
}).
serveFile('/', __dirname + '/images/ada.html')).
- addAction('/favicon.ico', new dispatch.SimpleAction(404, '<h1>404 Not Found</h1>')).
+ addAction('/favicon.ico', new dys.SimpleAction(404, '<h1>404 Not Found</h1>')).
start();
View
@@ -7,16 +7,16 @@
* @author dan@pupi.us (Daniel Pupius)
*/
-var dispatch = require('dispatch');
+var dys = require('dys');
-new dispatch.Server(4102, '127.0.0.1').
- addModule(new dispatch.StatsModule()).
- addModule(new dispatch.StaticFileModule({
+new dys.Server(4102, '127.0.0.1').
+ addModule(new dys.StatsModule()).
+ addModule(new dys.StaticFileModule({
// Disable browser caching and tell the module to only cache file for 2s,
// this makes development easier.
'cacheLifetime': 0, 'reStatTime': 2
}).serveFile('/', __dirname + '/stats.html')).
- addAction('/favicon.ico', new dispatch.SimpleAction(404, '<h1>404 Not Found</h1>')).
+ addAction('/favicon.ico', new dys.SimpleAction(404, '<h1>404 Not Found</h1>')).
addAction('/dostuff', function(ctx) {
var res = ctx.get('response');
var dates = [];
@@ -20,7 +20,7 @@ var util = require('util');
*/
function Module(realm) {
Module.super_.call(this, realm);
- this.logger_ = logging.getLogger('dispatch.auth.BasicAuthModule');
+ this.logger_ = logging.getLogger('dys.auth.BasicAuthModule');
}
util.inherits(Module, AuthModule);
@@ -23,7 +23,7 @@ var util = require('util');
*/
function Module(realm) {
Module.super_.call(this, realm);
- this.logger_ = logging.getLogger('dispatch.auth.DigestAuthModule');
+ this.logger_ = logging.getLogger('dys.auth.DigestAuthModule');
this.nonces_ = {};
this.nonceList_ = [];
View
@@ -1,7 +1,7 @@
var util = require('util');
-var logger = require('logging').getLogger('dispatch.errors');
+var logger = require('logging').getLogger('dys.errors');
exports.exec = function(ctx, callback, scope) {
View
@@ -21,7 +21,7 @@ function Module(db, host, port) {
this.host = host || 'localhost',
this.port = port || 27017;
- this.logger = logging.getLogger('dispatch.db.MongoModule');
+ this.logger = logging.getLogger('dys.db.MongoModule');
}
@@ -1,5 +1,5 @@
/**
- * @fileoverview Public interface to dispatch framework components, avoids apps
+ * @fileoverview Public interface to dys framework components, avoids apps
* needing to require() all the classes.
*
* @author dan@pupi.us (Daniel Pupius)
@@ -9,10 +9,10 @@ var base = require('./base');
module.exports = {
- // TODO: remove, use dispatch.errors.exec
+ // TODO: remove, use dys.errors.exec
exec: base.exec,
- // TODO: remove, use dispatch.errors.wrap
+ // TODO: remove, use dys.errors.wrap
wrap: base.wrap,
get App() {
@@ -1,5 +1,5 @@
/**
- * @fileoverview dispatch.interceptors namespace.
+ * @fileoverview dys.interceptors namespace.
*
* @author dan@pupi.us (Daniel Pupius)
*/
@@ -20,7 +20,7 @@ var util = require('../util');
* @constructor
*/
function RequestLogger(ctx) {
- this.logger_ = logging.getLogger('dispatch.RequestLogger');
+ this.logger_ = logging.getLogger('dys.RequestLogger');
this.buffer_ = [];
}
View
@@ -52,7 +52,7 @@ function Server(opt_port, opt_host) {
* @type {string}
* @private
*/
- this.name_ = 'node-dispatch';
+ this.name_ = 'node-dys';
/**
* Array of interceptors.
@@ -72,7 +72,7 @@ function Server(opt_port, opt_host) {
* @type {!Logger}
* @private
*/
- this.logger_ = logging.getLogger('dispatch.Server');
+ this.logger_ = logging.getLogger('dys.Server');
this.registerProviders_();
};
View
@@ -93,7 +93,7 @@ function Action(ctx, actionPath, basePath, fileReader, fileWriter, filter) {
* @type {!Logger}
* @private
*/
- this.logger_ = logging.getLogger('dispatch.static.Action');
+ this.logger_ = logging.getLogger('dys.static.Action');
var stats = ctx.get('stats', /* optional */ true);
if (stats) {
View
@@ -1,2 +1,18 @@
-{ "name" : "dispatch",
- "main" : "./lib/dispatch.js" }
+{
+ "name" : "dys",
+ "version" : "0.1.0",
+ "description" : "HTTP dispatching framework, using an action/interceptor model and Guice-like dependency injection.",
+ "keywords" : ["http", "web", "servlet", "filter", "action", "interceptor", "dependency injection"],
+ "repository" : {
+ "type" : "git",
+ "url" : "http://github.com/dpup/node-dys.git"
+ },
+ "homepage" : "https://github.com/dpup/node-dys",
+ "author" : {
+ "name" : "Daniel Pupius",
+ "email" : "dan@pupi.us",
+ "url" : "http://pupius.co.uk"
+ },
+ "main" : "./lib/dys.js",
+ "directories": {"lib": "./lib"}
+}

0 comments on commit 61a2d9a

Please sign in to comment.