Next.js Blog Dynamic Routes Tutorial - 404 when visiting /pages/[id]
Hi everyone,
I've started learning Next.js by following the starter blog tutorial (https://nextjs.org/learn/basics) but I'm stuck in the "Implement getStaticProps" section - I'm getting a 404 error whenever I try to visit
localhost:3000/posts/ssr-ssg or localhost:3000/posts/pre-rendering.
I've triple-checked that pages/posts/[id].js and lib/posts.js match the files in the next-learn repo (https://github.com/vercel/next-learn/blob/master/basics/dynamic-routes-step-1/), as suggested by the tutorial's troubleshooting section, but it's still not working. I'm not sure if it's an issue with getStaticPaths() or getStaticProps() in the pages/posts/[id].js file.
I've uploaded my files to a public GH repo - I would appreciate it if someone could clone it and take a look. Here's the link: https://github.com/ChromeUniverse/nextjs-blog
Thanks 🙂GitHub
GitHub - ChromeUniverse/nextjs-blog
Contribute to ChromeUniverse/nextjs-blog development by creating an account on GitHub.
2 Replies
where do you access the blog?
Because the route should be something like this:
/posts/123Sorry, I misspelled the title. I'm trying to access
/posts/[id], just like you said
But it's still not working
@deforestor Sorry, nevermind, I was typing the wrong URL all along.
god i feel so dumb 💀