add a check if json variable exists or not

Signed-off-by: Ashley <iamashley@duck.com>
This commit is contained in:
Ashley 2022-12-24 11:30:00 +00:00
parent 29cf785969
commit ab1bb9bd45

View file

@ -119,6 +119,10 @@ module.exports = function (app, config, renderTemplate) {
let url;
if (j_.URL != undefined) url = j_.URL;
//checks if json exists
if (json) {
//checks if title exists in the json object
if ("Title" in json) {
// json response
const re = {
@ -136,6 +140,7 @@ module.exports = function (app, config, renderTemplate) {
res.json(re);
}
}
});
app.get("/watch", async function (req, res) {