Content-Length: 362961 | pFad | http://github.com/coderboy-raiyan/Devto-2.0/commit/c17d9e7c99730624ad4489a8fcbc30e620cbe012

93 [DONE]-deploy done · coderboy-raiyan/Devto-2.0@c17d9e7 · GitHub
Skip to content

Commit c17d9e7

Browse files
[DONE]-deploy done
1 parent 3058cc6 commit c17d9e7

File tree

1 file changed

+29
-29
lines changed

1 file changed

+29
-29
lines changed

pages/blog/[slug].js

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -326,35 +326,7 @@ function SingleBlog({ singleBlog }) {
326326

327327
// get the blog from database using server side rendering
328328

329-
export async function getServerSideProps({ params }) {
330-
const res = await axios(`${baserUrl}/api/blogs/${params.slug}`);
331-
const singleBlog = res.data;
332-
333-
return {
334-
props: {
335-
singleBlog,
336-
},
337-
revalidate: 10,
338-
};
339-
}
340-
341-
// export async function getStaticPaths() {
342-
// const res = await axios(`${baserUrl}/api/blogs/allblogs`);
343-
// const data = res.data.blogs;
344-
345-
// const paths = data.map((blog) => ({
346-
// params: {
347-
// slug: blog?.slug,
348-
// },
349-
// }));
350-
351-
// return {
352-
// paths,
353-
// fallback: false,
354-
// };
355-
// }
356-
357-
// export async function getStaticProps({ params }) {
329+
// export async function getServerSideProps({ params }) {
358330
// const res = await axios(`${baserUrl}/api/blogs/${params.slug}`);
359331
// const singleBlog = res.data;
360332

@@ -366,4 +338,32 @@ export async function getServerSideProps({ params }) {
366338
// };
367339
// }
368340

341+
export async function getStaticPaths() {
342+
const res = await axios(`${baserUrl}/api/blogs/allblogs`);
343+
const data = res.data.blogs;
344+
345+
const paths = data.map((blog) => ({
346+
params: {
347+
slug: blog?.slug,
348+
},
349+
}));
350+
351+
return {
352+
paths,
353+
fallback: false,
354+
};
355+
}
356+
357+
export async function getStaticProps({ params }) {
358+
const res = await axios(`${baserUrl}/api/blogs/${params.slug}`);
359+
const singleBlog = res.data;
360+
361+
return {
362+
props: {
363+
singleBlog,
364+
},
365+
revalidate: 10,
366+
};
367+
}
368+
369369
export default SingleBlog;

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/coderboy-raiyan/Devto-2.0/commit/c17d9e7c99730624ad4489a8fcbc30e620cbe012

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy