Will server-side JavaScript take off? Which implem

2020-05-26 10:17发布

Does anyone see server-side JavaScript taking off? There are a couple of implementations out there, but it all seems to be a bit of a stretch (as in, "doing it BECAUSE WE CAN" type of attitude).

I'm curious to know if anyone actually writes JavaScript for the server-side and what their experiences with it have been to date.

Also, which implementation is generally seen as the most stable?

17条回答
叼着烟拽天下
2楼-- · 2020-05-26 10:24

Before it was acquired by Google, JotSpot used server-side JavaScript to let you query their database and display your pages. They used Rhino to do it. CouchDB uses server-side JavaScript to create views of their database.

As you can see from these examples, a great way to use JavaScript on the server is for plugins. One of the reasons it's used is that you can create a very isolated sandbox for people to run their code in. Also, because of the way that JavaScript as a language works, you can provide a user tooling specifically honed to the tasks your users need to complete. If you do this right, users don't need to learn a new language to complete their tasks, a quick glance at your API and examples is enough to get them on their way. Compare this to many of the other languages and you can see why using server-side JavaScript to provide a plugin architecture is so enticing.

A secondary popular solution, one which can be seen through a project like Jaxer, is that a common problem of web applications that do client-side validation is that, since JavaScript is easily bypassed in the browser, validation has to be run once again on the server. A system like Jaxer allows you to write some validation functionality that is reusable between both server and client.

查看更多
我想做一个坏孩纸
3楼-- · 2020-05-26 10:25

I see server-side js will offer considerable advantages in future applications. Why? Web apps that can go offline, client-side db store, google gears, etc...

Following this trend, more and more logic are moving into the client-side. Use an ORM that works for client-side, and use another on server-side (be it PHP / Ruby / whatever), write your synchronization logic twice in two different languages, write your business logic twice in two different languages?

How about use js on the client AND the server side and write the code once?

Convincing?

查看更多
Anthone
4楼-- · 2020-05-26 10:27

Server-side programming has been around for a lot longer than client side, and has lots of good solutions already.

JavaScript has survived and become popular purely because developers have very little choice in the matter - it's the only language that can interact with a DOM. Its only competition on the client side is from things like Flash and Silverlight which have a very different model.

This is also why JavaScript has received so much effort to smart it up and add modern features. If it were possible for the whole browser market to drop JavaScript and replace it with something designed properly for the task, I'm sure they would. As it stands Javascript has strange prototype-based objects, a few neat functional programming features, limited and quirky collections and very few libraries.

For small scripts it's fine, but it's a horrible language for writing large complicated systems. That things like Firefox and Gmail are (partly) written in it is a heroic accomplishment on their part, not a sign that the language is ready for real application development.

查看更多
三岁会撩人
5楼-- · 2020-05-26 10:28

Flash Media Server is scripted by using Server Side Action Script, which is really just javascript (ECMAScript). So, I do it a lot. In fact, most of my day was dealing with SSAS.

And I hate it. Though to be fair, a bunch of that is more related to the (not so great) codebase I inherited than the actual language.

查看更多
冷血范
6楼-- · 2020-05-26 10:33

I think server-side Javascript is guarenteed to take off. Its only a matter of time.

Mozilla, Google, and Adobe have so much vested interest for Javascript that it would take a miracle to dislodge it from the browser world. The next logical step is to move this into the server-side.

This is a step towards moving away from the hodge podge of Internet technology that usually includes all of these

  • HTML
  • CSS
  • Javascript
  • Serverside Language J2EE/ASP/Ruby/Python/PHP
  • SQL

I haven't heard much about the current state of Javascript Server frameworks, except that they are mostly incomplete.

查看更多
孤傲高冷的网名
7楼-- · 2020-05-26 10:34

I can't see most developers getting over their distaste for client-side JavaScript programming. I'd rather go to Java for server-side stuff before choosing JavaScript.

查看更多
登录 后发表回答