Created
January 9, 2020 09:38
-
-
Save CovertCode/667111ab5f4568c7e84bebbd86d5e69c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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