Last active
August 29, 2015 14:09
-
-
Save aclave1/5f9248da79f6d5888a50 to your computer and use it in GitHub Desktop.
job application for Envoc
This file contains hidden or 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'); | |
var body = JSON.stringify({ | |
Name:"OMITTED", | |
PhoneNumber: "OMITTED", | |
Email:"OMITTED", | |
Position:"Javascript Developer", | |
Urls:[ | |
{ | |
Type:'Resume', | |
Link:'OMITTED' | |
}, | |
{ | |
Type:'github', | |
Link:'https://github.com/aclave1' | |
}, | |
{ | |
Type:'the nodejs script used to create this request', | |
Link:'https://gist.github.com/aclave1/5f9248da79f6d5888a50' | |
} | |
] | |
}); | |
var options = { | |
host:'careers.envoc.com', | |
path:'/api/apply', | |
port:80, | |
method:'POST', | |
headers:{ | |
'Content-Type': 'application/json', | |
'Content-Length': body.length | |
} | |
}; | |
var req = http.request(options,function(response){ | |
var str = ''; | |
console.log(response.statusCode); | |
response.on('data',function(chunk){ | |
str += chunk; | |
}); | |
response.on('end',function(){ | |
console.log(str); | |
}); | |
response.on('error',function(err){ | |
console.log(err); | |
}); | |
}); | |
req.write(body); | |
req.end(); |
This file contains hidden or 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
//basically just receives the job application http request and prints it out | |
var http = require('http'); | |
http.createServer(function(req,res){ | |
var str = ''; | |
req.on('data',function(chunk){ | |
str += chunk; | |
}); | |
req.on('end',function(){ | |
var ob = JSON.parse(str); | |
console.dir(ob); | |
}); | |
res.write("congrats!"); | |
res.end(); | |
}).listen(8080); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment