movie release date

node v10.18.0
version: 20.0.0
endpointsharetweet
var express = require("@runkit/runkit/express-endpoint/1.0.0"); var request = require("request") var bodyParser = require('body-parser') var app = express(exports); app.use(bodyParser.json()) var key = process.env.moviekey app.post("/", (req, res) => { request({url:"http://www.omdbapi.com",qs:{t:req.body.movie,apikey:key}}, function(err, response, body) { if(err) { console.log(err); res.json({'date':"unknown"}); } else{ let r = JSON.parse(body) if(r.Released){ res.json({'date':r.Released}) } else{ res.json({'date':"unknown"}); } } } )})
Loading…

no comments

    sign in to comment