Reputation: 101
I am a hobby programmer with some experience in React, primarily using Firebase for my backend. Recently, I have started using Next.js and am wondering if I can use it as a small JSON-based database for local applications on my Raspberry Pi. I have set up LowDB and can access it from server-side rendered components, but I am unsure of the best way to make them accessible from interactive frontend components, such as allowing user input and saving it to the database. I have considered using Next.js's own API endpoint, but I am unsure if this is the most efficient and desired method. It feels strange to use a DB query in server-side components but an API for data changes.
Upvotes: 0
Views: 359
Reputation: 1213
NextJs as great framework derived from React, its more for UI frontend, for interacting with DB normally you would use an NodeJS API framework like NestJs or simply Express with some kickstart templates. You will not like use SSC since its just not the way/goal it was designed. like dentist doctor doing eye check haha
Happy coding!
Upvotes: 0