source: trip-planner-front/node_modules/needle/test/utils/formidable.js

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 559 bytes
Line 
1var formidable = require('formidable'),
2 http = require('http'),
3 util = require('util');
4
5var port = process.argv[2] || 8888;
6
7http.createServer(function(req, res) {
8 var form = new formidable.IncomingForm();
9 form.parse(req, function(err, fields, files) {
10 res.writeHead(200, {'content-type': 'text/plain'});
11 res.write('received upload:\n\n');
12 console.log(util.inspect({fields: fields, files: files}))
13 res.end(util.inspect({fields: fields, files: files}));
14 });
15}).listen(port);
16
17console.log('HTTP server listening on port ' + port);
Note: See TracBrowser for help on using the repository browser.