lewisdale.dev/src/_data/posts.js

17 lines
379 B
JavaScript
Raw Normal View History

2023-02-15 20:38:52 +00:00
const wordpressPassword = process.env.WORDPRESS_PASSWORD;
module.exports = async () => {
const response = await fetch("https://lewisdale.dev/wp-json/wp/v2/posts?per_page=100", {
headers: {
"Authorization": `Basic lewis:${wordpressPassword}`
}
});
const responses = await response.json();
console.log(JSON.stringify(responses[0], null, 2));
return responses;
};