Example files missing, referenced in folder structure docs.
From https://create.t3.gg/en/folder-structure#srcpagesapi
src/pages/api The api folder contains all the API routes of the Next.js application. The examples.ts file contains an example of a route that uses the Next.js API route feature along with Prisma. The restricted.ts file contains an example of a route that uses the Next.js API route feature and is protected by NextAuth.js.When I look through the actual folder structure of a newly scaffolded app I don't see either. Were they removed and just not updated in docs? Are those examples contained elsewhere in the structure now?
6 Replies
(thanks for putting all of this together, it's been v helpful so far!)
yea we removed these recently and forgot to update docs. thanks for spotting this 🙂
the reason we removed them is because if you want to build a backend within next we would strongly suggest trpc
so we didnt even want to show vanilla next anymore
Hey guys, I noticed this too. What is then the approach to have restricted areas of the app for logged-in users?
Also there are other files missing such as prettier.config.cjs. Why is so?
prettier.config.cjs should be there when you select tailwind
use
getServerAuthSession
in getServerSideProps and redirect
for API routes use protectedProcedure
Cool, Will check them out. Thanks!