is it a good idea to send html docs as string? what would be the best way to do it?
Unanswered
Schillerstövare posted this in #help-forum
SchillerstövareOP
Hi guys, i would like to know if it is a good idea to send html docs with nextjs? and if it is a good idea, what would be the best way to work like that.
For example, github. When you are authenticated or not, github can shows your repositories and other public repositories, but when you want to access to a private repository with the link it sends a 404 html page.
https://media.discordapp.net/attachments/752647196419031042/1197205362642800660/image.png?ex=65ba6b61&is=65a7f661&hm=791a4e9c1170e9e533e8f85a3cbcc8afa24747f29b97b80b5afd3ced0cd15eec&=&format=webp&quality=lossless&width=1440&height=640
what would be the best way to send a 404 html doc like github in case a user wants to enter to a page he doesnt have access or in other words instead of sending the real content of the page sends a 404 html code?
For example, github. When you are authenticated or not, github can shows your repositories and other public repositories, but when you want to access to a private repository with the link it sends a 404 html page.
https://media.discordapp.net/attachments/752647196419031042/1197205362642800660/image.png?ex=65ba6b61&is=65a7f661&hm=791a4e9c1170e9e533e8f85a3cbcc8afa24747f29b97b80b5afd3ced0cd15eec&=&format=webp&quality=lossless&width=1440&height=640
what would be the best way to send a 404 html doc like github in case a user wants to enter to a page he doesnt have access or in other words instead of sending the real content of the page sends a 404 html code?
2 Replies
@Schillerstövare Hi guys, i would like to know if it is a good idea to send html docs with nextjs? and if it is a good idea, what would be the best way to work like that.
For example, github. When you are authenticated or not, github can shows your repositories and other public repositories, but when you want to access to a private repository with the link it sends a 404 html page.
https://media.discordapp.net/attachments/752647196419031042/1197205362642800660/image.png?ex=65ba6b61&is=65a7f661&hm=791a4e9c1170e9e533e8f85a3cbcc8afa24747f29b97b80b5afd3ced0cd15eec&=&format=webp&quality=lossless&width=1440&height=640
what would be the best way to send a 404 html doc like github in case a user wants to enter to a page he doesnt have access or in other words instead of sending the real content of the page sends a 404 html code?
Use [notFound()](https://nextjs.org/docs/app/api-reference/functions/not-found)
See also [not-found.js](https://nextjs.org/docs/app/api-reference/file-conventions/not-found)