Hello, I've got a question... Can Next work as a back-end? I would want to process the data on server-side constantly let's say 5s revalidate and make request calls from front-end (client) to server for fresh data... Is it possible? I would want to make real-time data fetching from server... API Calls might work like that? I would want to make that API work all the time, process the data independently of users requests and then the user will make a call and get fresh data 😬
#Next as a back-end, real-time data fetching
20 messages · Page 1 of 1 (latest)
yes this is possible using next.js
and yeah will be easy to manage
Just by API?
you can't use real time stuff like ws or socketio in api routes
Let's say I will have some type of widget to show real-time crypto prices... I don't won't to process it on client-side and to not reprocess it with every call, just process it all the time and let users grab the data from server any time
in this case you should use some actual realtime protocol like ws or socketio
yeah possible
next.js api routes are not appropriate for that
possible using next but not recommended
exactly
cause your page will be slow and might crash with some errors
it is impossible to do with api routes if you host in somewhere like vercel
yeah
however if the data isn't too realtime but still updates pretty often like 5 secs you can use http and api routes
Or work with the database on the server-side... I would want to have some type of a login system, I would want to encrypt the data on client-side, send it to back-end, do some stuff on the back-end with the data, send it to DB to not make calls client - db, only server will have connection with DB, grab the data from db, encrypt, decrypt and send user only that what he needs without sensitive data
yeah can use next
How should I do that? Can I use some type of frameworks for encryption on API routes? How can I make server to fetch and process the data and then make calls from client-side for processed data