wp-json/wp/v2/posts gets you all the posts wp-json/wp/v2/posts?slug=hello-world will give you a particular post also please check for the permalink structure on your WordPress.
Thank you for your reply. I have not tried the permalink with post-name yet, but i am hesitant to use that because there might be posts with same title which might end up creating same post-names and, therefore, maybe conflict with querying. Not sure. I will soon try things out and see how they go.
wp-json/wp/v2/posts
gets you all the postswp-json/wp/v2/posts?slug=hello-world
will give you a particular post also please check for the permalink structure on your WordPress.Thank you for your reply. I have not tried the permalink with post-name yet, but i am hesitant to use that because there might be posts with same title which might end up creating same post-names and, therefore, maybe conflict with querying. Not sure. I will soon try things out and see how they go.
Thanks, I think permalinks will create unique slugs.
Pls try and let me know. I am glad you find this post helpful.
I could get the request on the browser but not through the sapper page.
That's odd, what seems to be the error?
I saw that the json that I received was an array, not a single object. Therefore, I did iterate for arr[0] to get that single object.
In the [slug] page I did this: return { post: data[0] };
Yes that is right, I have covered it in the next post there are 5 parts right now.
Also I have pushed my repo github.com/peopledrivemecrazy/Sapp...