kopia lustrzana https://github.com/miklobit/TiddlyWiki5
Put request handler on SimpleServer.prototype (#2627)
The request handler may be used by ExpressJS apps directly and can do most of the heavy lifting without any modification. Note that the self variable must be assignee using `[Function].bind(null,SimpleServer instance)`.print-window-tiddler
rodzic
a2fe101848
commit
1530b3e2d8
|
@ -91,10 +91,9 @@ SimpleServer.prototype.checkCredentials = function(request,incomingUsername,inco
|
|||
}
|
||||
};
|
||||
|
||||
SimpleServer.prototype.listen = function(port,host) {
|
||||
var self = this;
|
||||
http.createServer(function(request,response) {
|
||||
SimpleServer.prototype.requestHandler = function(request,response) {
|
||||
// Compose the state object
|
||||
var self = this;
|
||||
var state = {};
|
||||
state.wiki = self.wiki;
|
||||
state.server = self;
|
||||
|
@ -141,7 +140,10 @@ SimpleServer.prototype.listen = function(port,host) {
|
|||
});
|
||||
break;
|
||||
}
|
||||
}).listen(port,host);
|
||||
};
|
||||
|
||||
SimpleServer.prototype.listen = function(port,host) {
|
||||
http.createServer(this.requestHandler.bind(this)).listen(port,host);
|
||||
};
|
||||
|
||||
var Command = function(params,commander,callback) {
|
||||
|
|
Ładowanie…
Reference in New Issue