Note: This post is a summary of information paraphrased from an excellent blog post by Christian Sepulveda.
Create the app and download the necessary dependencies.
import * as qs from "qs"; | |
import { PathLike } from "fs"; | |
export const apiConfig = { | |
returnRejectedPromiseOnError: true, | |
withCredentials: true, | |
timeout: 30000, | |
baseURL: "https://jsonplaceholder.typicode.com/", | |
headers: { | |
common: { |
/** extracted page creation functionality into smaller functions **/ | |
const path = require('path'); | |
function createBlogPostsPages(result, createPage) { | |
const blogPostTemplate = path.join(__dirname, `../src/templates/blog-post.js`); | |
const blogPosts = result.data.blogs.edges; | |
blogPosts.forEach((post, index) => { | |
const previous = index === blogPosts.length - 1 ? null : blogPosts[index + 1].node; |
Create the app and download the necessary dependencies.