Is it possible to write the backend using JavaScript?

那年仲夏 提交于 2019-12-03 09:56:34

问题


As we all know, JavaScript is widespread on the web. For client side scripting it does a great job.

But is it possible to take JavaScript outside the browser? For example, writing a streaming socket or writing DB, doing schedule job? Things like that in the backend? Thanks.


回答1:


Have a look at node.js. It does a certain number of things very well, but may not be best suited for all purposes.

If you are looking to do stuff that involves a lot of parallell processes and/or you want to keep persistent connections open to and from a user's browser, then it may be perfect.




回答2:


Yes, you can do a lot of backend things in Javascript.

There is a lot of frameworks and application that runs Javascript as a backend, all with different pros and cons.

NodeJs

Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.

OPA

Opa is an advanced application framework for JavaScript. All aspects are directly written in Opa: Frontend code, backend code, database queries and configuration. And everything is strongly statically typed.

CommonJs

The CommonJS API will fill that gap by defining APIs that handle many common application needs, ultimately providing a standard library as rich as those of Python, Ruby and Java. The intention is that an application developer will be able to write an application using the CommonJS APIs and then run that application across different JavaScript interpreters and host environments.

Vertx.io

Vert.x is the framework for the next generation of asynchronous, effortlessly scalable, concurrent applications. Vert.x is an event driven application framework that runs on the JVM - a run-time with real concurrency and unrivalled performance. Vert.x then exposes the API in Ruby, Java, Groovy, JavaScript and Python. So you choose what language you want to use. Scala and Clojure support is on the roadmap too.




回答3:


Along with node.js, have a look at vert.x.




回答4:


This site is written by node.js

Using websvr, it's Java style have filter and handlers.




回答5:


Never used it , but for server-side JS the most populate framework is nodejs http://nodejs.org




回答6:


Yes, you can utilize JavaScript outside the browser. Both for server-side scripting (similar to JSP or ASP). This can most notably be accomplished using Node.js (http://www.commonjs.org/) however there are other options available. Similarly you can create aps entirely outside of the webspace using the CommonJS API (http://www.commonjs.org/).

Check out the Wikipedia article about JavaScript (http://en.wikipedia.org/wiki/JavaScript#Server-side_JavaScript).



来源:https://stackoverflow.com/questions/11652026/is-it-possible-to-write-the-backend-using-javascript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!