Skip to content

Commit

Permalink
Update data-fetching.md
Browse files Browse the repository at this point in the history
  • Loading branch information
DylanRJohnston authored Oct 1, 2020
1 parent d85a11b commit 5b98300
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/basic-features/data-fetching.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,12 +255,12 @@ function Blog({ posts }) {
// It won't be called on client-side, so you can even do
// direct database queries. See the "Technical details" section.
export async function getStaticProps() {
const postsDirectory = path.join(process.cwd(), "posts")
const postsDirectory = path.join(process.cwd(), 'posts')
const filenames = fs.readdirSync(postsDirectory)

const posts = filenames.map(async (filename) => {
const filePath = path.join(postsDirectory, filename)
const fileContents = await readFile(filePath, "utf8")
const fileContents = await readFile(filePath, 'utf8')

// Generally you would parse/transform the contents
// For example you can transform markdown to HTML here
Expand Down

0 comments on commit 5b98300

Please sign in to comment.