-
Notifications
You must be signed in to change notification settings - Fork 3
/
app.js
35 lines (25 loc) · 793 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
var nock = require('nock');
var express = require('express')
var app = express()
app.get('/', function (req, res) {
var couchdb = nock('http://www.google.com')
.get('/')
.reply(200, {
_id: '123ABC',
_rev: '946B7D1C',
username: 'dzuluaga',
email: '[email protected]'
});
var request = require('request')
request('http://www.google.com', function(error, response, body){
if(!error && response.statusCode == 200){
console.log(body)
res.send(body)
}
})
})
var server = app.listen(3000, function () {
var host = server.address().address
var port = server.address().port
console.log('Example app listening at http://%s:%s', host, port)
})