-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi.js
More file actions
36 lines (29 loc) · 841 Bytes
/
api.js
File metadata and controls
36 lines (29 loc) · 841 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
31
32
33
34
35
36
var ApiUrl = "https://api.themoviedb.org/3/movie/popular?api_key=00a5413fc6eece2c892527c321a523a5&language=en-US&page=1"
var http = require("http")
function getJson(urloption, callBack){
http.request(urloption, function(res){
var body = "";
res.on("data",function (chunk){
body += chunk
});
res.on("end", function(){
var movieinfo = JSON.parse(body);
callBack(null, movieinfo);
});
res.on("error",callBack);
})
.on("error",callBack)
.end();
}
var urloption = {
host: "api.themoviedb.org",
path:"/3/movie/popular?api_key=00a5413fc6eece2c892527c321a523a5&language=en-US&page=1",
method: "GET"
};
//00a5413fc6eece2c892527c321a523a5
getJson(urloption, (err,result)=>{
if(err){
return console.log("Error "+err);
}
console.log(result)
});