@@ -26,6 +26,8 @@ var assert = require("assert"),
26
26
fs = require ( "fs" ) ,
27
27
path = require ( "path" ) ,
28
28
express = require ( "express" ) ,
29
+ http = require ( "http" ) ,
30
+ multipart = require ( "connect-multiparty" ) ,
29
31
DialbackClient = require ( "dialback-client" ) ,
30
32
databank = require ( "databank" ) ,
31
33
Databank = databank . Databank ,
@@ -42,13 +44,14 @@ var tc = JSON.parse(fs.readFileSync(path.join(__dirname, "config.json")));
42
44
43
45
var tinyApp = function ( port , hostname , callback ) {
44
46
45
- var app = express . createServer ( ) ;
47
+ var app = express ( ) ,
48
+ appServer = http . createServer ( app ) ;
46
49
47
50
app . set ( "port" , port ) ;
48
51
app . use ( express . json ( ) ) ;
49
- app . use ( express . urlencoded ( ) ) ;
50
- app . use ( express . multipart ( ) ) ;
51
- app . use ( app . router ) ;
52
+ app . use ( express . urlencoded ( { extended : true } ) ) ;
53
+ // TODO: use the multiparty API directly instead of this Connect middleware wrapper
54
+ app . use ( multipart ( ) ) ;
52
55
53
56
app . get ( "/.well-known/host-meta.json" , function ( req , res ) {
54
57
res . json ( {
@@ -87,7 +90,7 @@ var tinyApp = function(port, hostname, callback) {
87
90
} ) ;
88
91
89
92
app . listen ( port , hostname , function ( ) {
90
- callback ( null , app ) ;
93
+ callback ( null , appServer ) ;
91
94
} ) ;
92
95
} ;
93
96
0 commit comments