Skip to content

Instantly share code, notes, and snippets.

@Hurly77
Created April 23, 2021 02:18
Show Gist options
  • Save Hurly77/78610beae642fd8fbea9d29296fa8b1f to your computer and use it in GitHub Desktop.
Save Hurly77/78610beae642fd8fbea9d29296fa8b1f to your computer and use it in GitHub Desktop.
//we can actually import what ever node modules we want as long as we only use them in the getStaticProps method
import path from 'path';
...
export const getStaticProps = async() => {
//proccess is a global object that can be accessed anywhere with in a node application. Because nextJS doesn't read getStaticProps as a client file we can use the process object.
//cwd = current working directory. and will actually view the current directory as the top level.
const filePath = path.join(process.cwd())
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