Created
April 23, 2021 02:17
-
-
Save Hurly77/e244915ed52392a0622f257516599ec2 to your computer and use it in GitHub Desktop.
This file contains 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
//as long as we don't attempt to use this in the client side code Next will split this away from the client side render. so the client wont see this import. | |
import fs from 'fs' | |
... | |
export const getStaticProps = async() => { | |
//normally we would not be able to run the fs.readFile() method but with Next we can actually import this in here and use the same way we would in a node application. | |
fs.readFileSync() | |
return {props: { | |
products: [id: 'p1', title: 'Product 1'] | |
}} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment