Skip to content

Instantly share code, notes, and snippets.

@CovertCode
Created January 9, 2020 09:38
Show Gist options
  • Save CovertCode/667111ab5f4568c7e84bebbd86d5e69c to your computer and use it in GitHub Desktop.
Save CovertCode/667111ab5f4568c7e84bebbd86d5e69c to your computer and use it in GitHub Desktop.
router.get("/:xxxx", async (req, res) => {
let postPath = `/${xxxx}/${xxxx}/${title}`;
let postByURL = `.....`;
await axios
.get(postByURL)
.then(response => {
let {
......
} = response.data;
let dom = new JSDOM(content);
let authorName = author.displayName;
let featuredImage = dom.window.document
.querySelector("img")
.getAttribute("src");
let medtaDescription = dom.window.document.querySelector("b").textContent;
let article = {
title,
content,
labels,
......
};
res.render("single", {
......
});
})
.catch(error => {
console.log(error);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment