-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathroutes.js
More file actions
30 lines (20 loc) · 798 Bytes
/
routes.js
File metadata and controls
30 lines (20 loc) · 798 Bytes
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
const scrape = require('./scrape.js');
module.exports.getHome = ( req, resp ) => {
scrape.search(`https://www.google.com/search?q=memes&source=lnms&tbm=isch&sa=X&ved=0ahUKEwiW7orfqpvTAhWDz4MKHQm3D3cQ_AUIBigB&biw=555&bih=618`, 'memes', (err, data) => {
if (err) {
console.log( err );
return;
}
resp.json( data );
});
};
module.exports.search = ( req, resp ) => {
var query = req.params.query;
scrape.search(`https://www.google.com/search?q=${ query }+memes&source=lnms&tbm=isch&sa=X&ved=0ahUKEwiW7orfqpvTAhWDz4MKHQm3D3cQ_AUIBigB&biw=555&bih=618`, query, (err, data) => {
if (err) {
console.log( err );
return;
}
resp.json( data );
});
};