何时以及如何使用服务器端JavaScript? [英] When and how do you use server side JavaScript?

查看:106
本文介绍了何时以及如何使用服务器端JavaScript?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

偶尔我会搜索一些JavaScript帮助,然后我会遇到服务器端JavaScript这个术语。你什么时候使用JavaScript服务器端?如何?

Occasionally I search for some JavaScript help and I come upon the term "Server-side JavaScript". When would you use JavaScript server-side? And how?

我的JavaScript体验一直在浏览器中。是否有JS的编译版本?

My experiences of JavaScript have been in the browser. Is there a compiled version of JS?

推荐答案

有项目 Phobos ,这是一个服务器端JavaScript框架。

There's the project Phobos, which is a server side JavaScript framework.

Back In The Day,Netscape Web服务器提供服务器端java脚本。

Back In The Day, the Netscape web server offered server-side java script as well.

在这两种情况下,使用JavaScript就像在服务器上使用任何语言一样。通常用于处理HTTP请求并生成内容。

In both of these cases, JavaScript is used just like you'd use any language on the server. Typically to handle HTTP requests and generate content.

Rhino ,这是Mozilla的Java JavaScript系统,它将JavaScript编译成Java字节码,JVM可以选择JIT。其他系统使用其他方法来执行java脚本,甚至有些是JIT编译他们的java脚本内部代码。

Rhino, which is Mozilla's JavaScript system for Java, compiles JavaScript in to Java byte codes, which the JVM can choose to JIT. Other systems use other means for executing java script, even to the point that some are JIT compiling their java script internal codes.

我预见会有越来越多的JavaScript在服务器上。当您在客户端上使用JavaScript编写厚应用程序时,您也可以在服务器上用JavaScript编写逻辑,以便不必从一种语言到另一种语言进行认知跳跃。环境会有所不同,但你的大部分代码和知识都是可以共享的。

I foresee that there will be more and more JavaScript on the server. When you're writing "thick" applications in JavaScript on the client, then you may as well be able to write your logic in JavaScript on the server in order to not have to make the cognitive leaps from one language to another. The environments will be different, but much of your code and knowledge will be shareable.

最后,JavaScript可能是现在最赚钱的单一语言在实施方面。来自Apple,Mozilla,Google,甚至Microsoft,以及努力使其成为更高级的语言(即基本上是一个带有Algol语法的方案,没有宏)。

Finally, JavaScript is probably the singular language that has the most money pointing at it right now in terms of implementations. From Apple, Mozilla, Google, and even Microsoft as well as the efforts to make it an even more advanced language (i.e. basically a Scheme with Algol syntax sans macros).

大部分实现都隐藏在浏览器中,但这并不是说服务器端也没有价值。

Most of those implementation are buried in the browser, but that's not to say that there's no value on the server side as well.

工具是JavaScript最大的地方缺乏,特别是在服务器端,但如果你考虑像Phobos,你可以在IDE中调试服务器端JavaScript,这是一个很大的进步。

The tooling is the biggest place where JavaScript is lacking, especially on the server side, but if you consider something like Phobos, where you can debug your server side JavaScript in the IDE, that's a great advancement.

就个人而言,我在我的应用程序中抛出JavaScript,比如白色涂料。它以极低的成本提供廉价的可扩展性,是一个很好的推动者。

Personally, I'm tossing JavaScript around in my applications like white paint. It offers cheap extensibility for very little cost and is a great enabler.

这篇关于何时以及如何使用服务器端JavaScript?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆