Skip to content

Instantly share code, notes, and snippets.

@heapwolf heapwolf/43.js
Created Aug 7, 2012

What would you like to do?
var fs = require('fs');
require('http').createServer(function(req, res) {
res.writeHead(200, {'Content-Type': 'text/html'});
if (req.method === 'GET') {
fs.createReadStream(__dirname + '/form.html').pipe(res);
} else {
var fileName = __dirname + '/request_' + + '.log';
console.log('writing to ', fileName);
var file = fs.createWriteStream(fileName);
req.on('end', function() {
res.end('Submitted, thanks');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.