Created
August 24, 2014 02:13
-
-
Save antimatter15/2dfeb602e1f98d7f1989 to your computer and use it in GitHub Desktop.
FOAR SCOTT FRUM BOXXY
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http'), | |
path = require('path'), | |
fs = require('fs'); | |
http.createServer(function(req, res) { | |
res.writeHead(200, {'Content-Type': 'text/plain'}); | |
if(req.method.toUpperCase() == "POST"){ | |
var file = path.normalize(req.url); | |
console.log(file); | |
req.pipe(fs.createWriteStream(__dirname + file)) | |
res.end("fin.\n"); | |
}else{ | |
res.end("I'm sorry, but we only accept postcards from Paris.\n"); | |
} | |
}).listen(14361, '127.0.0.1'); | |
function fafnir(name, data){ | |
var xhr = new XMLHttpRequest(); | |
xhr.open('POST', 'http://127.0.0.1:14361/' + name, true); | |
xhr.send(data); | |
} | |
console.log(fafnir.toString()); | |
console.log('_____________________________________________') | |
// Chapter 8 Section 8 of LoTR Volume 3: The Extended Cut |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment