Skip to content

Commit 1030bfa

Browse files
committed
Updated examples
1 parent a230d94 commit 1030bfa

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

example/post.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
require('../test/common');
1+
var common = require('../test/common');
22
var http = require('http'),
33
util = require('util'),
4-
formidable = require('formidable'),
4+
formidable = common.formidable,
5+
port = common.port,
56
server;
67

78
server = http.createServer(function(req, res) {
@@ -38,6 +39,6 @@ server = http.createServer(function(req, res) {
3839
res.end('404');
3940
}
4041
});
41-
server.listen(TEST_PORT);
42+
server.listen(port);
4243

43-
console.log('listening on http://localhost:'+TEST_PORT+'/');
44+
console.log('listening on http://localhost:'+port+'/');

example/upload.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
require('../test/common');
1+
var common = require('../test/common');
22
var http = require('http'),
33
util = require('util'),
4-
formidable = require('formidable'),
4+
os = require('os'),
5+
formidable = common.formidable,
6+
port = common.port,
57
server;
68

79
server = http.createServer(function(req, res) {
@@ -19,7 +21,7 @@ server = http.createServer(function(req, res) {
1921
files = [],
2022
fields = [];
2123

22-
form.uploadDir = TEST_TMP;
24+
form.uploadDir = os.tmpdir();
2325

2426
form
2527
.on('field', function(field, value) {
@@ -43,6 +45,6 @@ server = http.createServer(function(req, res) {
4345
res.end('404');
4446
}
4547
});
46-
server.listen(TEST_PORT);
48+
server.listen(port);
4749

48-
console.log('listening on http://localhost:'+TEST_PORT+'/');
50+
console.log('listening on http://localhost:'+port+'/');

0 commit comments

Comments
 (0)