javascript - What are the benefits of Next.js Server Actions, and why should I use them instead of client-side API calls? - Stac
- c - Solaris 10 make Error code 1 Fatal Error when trying to build python 2.7.16 - Stack Overflow 推荐度:
- javascript - How to dismiss a phonegap notification programmatically - Stack Overflow 推荐度:
- javascript - Get the JSON objects that are not present in another array - Stack Overflow 推荐度:
- javascript - VS 2015 Angular 2 import modules cannot be resolved - Stack Overflow 推荐度:
- javascript - Type 'undefined' is not assignable to type 'menuItemProps[]' - Stack Overflow 推荐度:
- 相关推荐
I am working on a Nextjs web application. I am using server actions for fetching data and submitting forms using rest apis in java spring boot. It works great. However, I have a few doubts in my mind and I noticed a couple of drawbacks as well.
For server action, they do not show up in network tab. So, for manual QA it is not possible to see what is being sent to server and what is being returned.
How much of a difference will it make if I ditch server actions and stick with client api calls?
I would appreciate a detailed answer to help me understand this.
I am working on a Nextjs web application. I am using server actions for fetching data and submitting forms using rest apis in java spring boot. It works great. However, I have a few doubts in my mind and I noticed a couple of drawbacks as well.
For server action, they do not show up in network tab. So, for manual QA it is not possible to see what is being sent to server and what is being returned.
How much of a difference will it make if I ditch server actions and stick with client api calls?
I would appreciate a detailed answer to help me understand this.
Share Improve this question asked yesterday Musadiq KhanMusadiq Khan 1511 silver badge11 bronze badges1 Answer
Reset to default 0SO isn't generally meant for open-ended questions, but I'd like to help.
When you're using Next.js and Server Actions you are in essence creating yet another server to talk to your Java server. Yes, you could easily switch to client api calls. But, depending on your application requirements, it should probably have a stronger motivation than just to be able to see the api calls in the network tab.
Why you might prefer server actions:
- Privacy. If you can't see anything in the network, neither can any bad actor. This also means that you can worry less about user authentication.
- Performance. If you plan to make an API call to your server which in turn relays it to the Java server, that's an extra detour causing slower speeds and more traffic.
- More traffic translates to more cost to maintain the server.
- Server side rendering is better for SEO, since the pages are pre-rendering and so web crawlers already have all the information needed about your application. (But I'm guessing this is not important for your application.)
Suggestions for manual testing of server actions:
- Simple logging of the requests and responses. You can send these logs to a file or to a dedicated tool like Datadog.
- Instead of opening your app in a browser that triggers the backend api call, expose an API endpoint. Then call this endpoint from a tool like Postman.
- 从基础软硬件兼容性谈桌面云的应用
- 虚拟现实技术2015年将迎来爆发
- 忘记安卓电脑 ChromeWin双系统PC更有前途
- 以色列导航软件公司Waze被谷歌收购
- Intel毫不客气:ARM+Win8软硬件都不行
- visual studio code - Why am I getting “Type annotations can only be used in TypeScript files” with tsx files? - Stack Overflow
- ios - CocoaPods could not find compatible versions for pod "FirebaseCore": - Stack Overflow
- python - How to add a linear gradient to a QTableWidget? - Stack Overflow
- r - Elegant vectorization of nested for loop - Stack Overflow
- Azure monitor alert using minimum failing periods for static threshold - Stack Overflow
- javascript - Why does every object in BabylonJS require a name? - Stack Overflow
- web - Framer Motion Scrollable - Stack Overflow
- c++ - Incremental compilation using Makefile - Stack Overflow
- pine script - Is there a way to incorporate dynamic commission fees in the TradingView Strategy Tester? - Stack Overflow
- python - ReCaptcha v3 works locally but not in deployment - Stack Overflow
- Generic Trait Parameters in Rust - Stack Overflow
- arkit - Detecting and Using 2 Different Vertical Planes - Stack Overflow