前端与后端问题隔离

发布于 2024-10-04 01:58:18 字数 138 浏览 0 评论 0原文

这个问题很笼统,还是希望有人指点。

在 Web 应用程序中,例如 Facebook 或 Amazon 或任何网站,如何隔离问题是在前端(客户端)还是后端(服务器端)?我觉得必须有非常基本的故障排除步骤才能找出这个问题。

提前致谢。

This is very generic question, still I hope someone will provide pointers.

In a web application, say Facebook or Amazon or any web site, how do I isolate if a problem is on frontend (client side) or backend (server side)? I feel there has to be very basic troubleshooting steps available to find out this.

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

旧伤还要旧人安 2024-10-11 01:58:18

好吧,您需要调试并确保客户端一切正常工作。如果所有的值都正确,那么它一定是服务器端的。

不过,如今代码可能变得非常复杂,因此这实际上取决于您的技能水平和经验/知识。如果您是初学者,那么我建议您学习越来越多的客户端和服务器端,以便知道要调试什么。

大多数时候,当你学习时,如果你没有达到高级水平,你可能不得不求助于询问其他人,这完全没问题。只需在像 SO 这样的网站上询问,您遇到的问题越多,您获得的技巧就越多,这将使您成为更好的调试者和开发人员。

Well, you need to debug and make sure everything is working properly on the client side. If all the values are right, then it must be the server-side.

Though, nowadays code can get pretty complex so it really depends on your skill-level and experience/knowledge. If you are a beginner then I would recommend learning more and more client-side and server-side in order to know what to debug.

The majority of the time as you are learning you'll probably have to resort to asking other people if you aren't at an advanced level, which is perfectly fine. Just ask away on sites like SO and the more problems you run into, the more tips you'll acquire which will make you a better debugger and developer.

可可 2024-10-11 01:58:18

由于服务器端部分在您的控制之下,因此您可以轻松启用日志记录,以便您可以看到问题所在。

客户端有点棘手,因为它是在用户的浏览器上执行的,因此它不受您的直接控制。

但是,如果客户端发生异常,您始终可以捕获它并使用 AJAX 将该信息发送到您的服务器,其中包含一些信息(例如“clientError”),您可以将其记录为这样,因此通过 grep 的基本用法,您将知道实际问题出在哪里。

如果存在客户端问题并且 AJAX 调用失败(例如客户端出现网络问题),您可以将错误信息放入 cookie 中并在事后收集它。

Since server side part is under your control, you can easily enable logging so you'll see where a problem lies.

Client side is a bit more tricky since it's executed on user's browser, so it's not under your direct control.

But, if an exception occurs on client side, you can always catch it and send that information to your server using AJAX with some info like "clientError", where you can log it as that, so with basic usage of grep, you'll know where the actual problem lies.

If there's a client side problem and an AJAX call fails (for example, client has network problems), you can put error info in a cookie and collect it afterwards.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文