Reputation: 149
I am trying to fetch my own data before rendering my application. Fortunately, Next.js provides getStaticProps()
for fetching data.
I am currently using fs
module to fetch my data from json file in local directory.
export async function getStaticProps() {
const rawData = fs.readFileSync('./dataset/test.json');
const data = modifyData(JSON.parse(rawData));
return {
props: {
data
}
}
}
But the problem is, for securing my raw data, I didn't push them to the GitHub remote repository. Forgetting this, when I tried to deploy my app through vercel, it couldn't read any data from my GitHub repository as the repository does not contain any data to fetch from...
I don't want to push my raw data to GitHub.
I would like to know
If there are some fundamentals of Next.js or any other I missed, please let me know and correct me.
Upvotes: 0
Views: 272