Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 2 years ago.
Improve this question
I am new in js and nodejs. I am studing about nodejs in different web sites like w3schools. I learned that nodejs is a kind of server that can run js in the backend of a website . but my mentor told me it is not a server . it is just an engine in the server that can run js. now I am a little confused. I hope someone tell me what exactly nodejs is or tell me a good reference to learn about nodejs.
thank you
Your mentor is wrong, but still kind of right.
Node.js is an open source server environment.
Originally, it came into existence when the developers of JavaScript extended it from something you could only run in the browser to something you could run on your machine as a standalone application.
Nowadays, it's a JavaScript runtime built on Chrome’s V8 JavaScript engine.
Now, this is as you can see indeed a server as it serves your javascript files. However, in difference to a php server, Node.js is designed without threads.
But that doesn't mean you can't take advantage of multiple cores in your environment, and is something I believe your mentor aren't aware of.
Conclusion
Node. js is an application runtime environment that allows you to write server-side applications in JavaScript. Thanks to its unique I/O model, it excels at the sort of scalable and real-time situations we are increasingly demanding of our servers.
It`s an engine that give you possibility to run js scripts in standalone mode. Instead of browser mode.
I agree with #Sergey that node js is engine firstly.
Node.js allows the creation of Web servers and networking tools using JavaScript and a collection of "modules" that handle various core functionalities.Modules are provided for file system I/O, networking (DNS, HTTP, TCP, TLS/SSL, or UDP), binary data (buffers), cryptography functions, data streams, and other core functions. Node.js's modules use an API designed to reduce the complexity of writing server applications.
you can learn about node.js from w3Schools
and Tutorials point are best sites for node.js learning
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
I happened to use a coding platform which didn't give the option to write code in JavaScript but rather gave node as an option. I don't have much experience in Node , so just wanted to know if I could proceed writing the code in pure JavaScript and not face any issues?
Pure JavaScript doesn't get you very far; you need APIs provided by the host environment to allow for most forms of input and output. I mention this because a lot of people confuse "Pure JS" with "JS + Browser supplied APIs".
The APIs provided by Node.js are different to the APIs provided by the runtimes in browsers (the most obvious difference being that if you are writing for a web browser then you'll have a DOM generated by an HTML document to manipulate by default).
That said, there aren't many pure JS features that Node.js lacks.
The only one I can think off of the top of my head is that ES6 modules are not enabled by default since Node.js implemented CommonJS modules before ES6 modules had been added to the specification. You have to enable ES6 modules explicitly if you want to use them.
Node.js is a popular runtime for Javascript. It is one of the ways to run javascript. It's not 'impure' (depending on your definition on pure/impure).
Pure Javascript (Javascript code that does not rely on any libraries that are not defined in the ECMAScript standard) will run in any Javascript environment such as a browser or nodejs that supports the version of ECMAScript you are targeting.
But, pure Javascript can't really do much on its own because it has no display, no file system, no networking, etc... To get some of those things, you need a supporting Javascript environment that has it's own APIs for those types of things.
The supporting environments are generally not compatible. For example, if you want to make an http request to another host, you do that completely differently when running in nodejs versus when running in a browser though you can get a library for nodejs that simulates some browser APIs such as node-fetch simulates the fetch() interface from the browser.
So, it really depends upon what you're trying to do. If a coding platform specifies node, then that's probably because that coding platform relies on other APIs that are specific to node and you will need to use node. For more specific details, we would need to know what the environment is and what the coding project is.
This question already has answers here:
Serverside and clientside javascript
(4 answers)
Closed 9 years ago.
I read this article that says that PayPal may leave Java and go with JavaScript. I was amazed of this, does this mean that JavaScript can be used as a server side language like Python, PHP, etc? What I know about JavaScript is that it is a client side language.
Use Node.js
http://nodejs.org/
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.
Current Version: v0.10.23
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I have read this article (Uses of Javascript), while it is right I know there are other uses of javascript, modern javascript nowadays. I haven't read about node.js and how this one works but I have heard that this one makes js do server-side stuffs?
The question is, what are other uses of javascript, can this replace php and ruby? I know this might not be a good idea for enterprise applications but will work well with medium-size applications, am I right?
What are the other uses of javascript other than the one given in the article?
Javascript can very well be used server side. If you're on an IIS server, you can for example use JScript, nodejs, v8cgi (currently known as TeaJS), or a combination of these. On *nix servers nodejs is a popular framework. Nodejs can even be used to program your own webserver (e.g. using the expressjs framework).
Dive in the given links and see what's possible.
There is TESSEL and Espruino javascript inside microcontroller.
I use Node.js for web application for few years, few projects and really happy so far.
The Express.js + MongoDB makes a perfect match (exactly as PHP + MySQL, 5 years ago). You can find reference on MEAN stack.
It works good no only for small applications. We have medium-size app that could be easily scaled up.
Node.js is not to about substitute PHP or Ruby, but what's happening now is indeed, it's more and more used for web applications nowaday. The reason is simple, Node.js has "web-oriented" core, meaning it's originally created to aim highly productive tcp/http applications. With some progress beautiful web development frameworks appeared on top of Node.js that makes web application development even more easy and fun.
For me, programming Node.js on server makes a lot of sense, since JavaScript is main client-side language (almost without alternatives), so context-switching between client/server programming is less. With practice you get use to some initial JavaScript weirdness and things goes smooth and nice.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I've taught myself HTML and CSS and I'm in the process of going into Javascript. I see a lot of things written about web apps (guessing they are the type of thing you get on the Chrome store etc.) but I can't find a definitive guide as to what language they are written in. I know extensions are written in javascript, but what about web apps?
A web application is any application that uses a web browser as a client. The application can be as simple as a message board or a guest sign-in book on a website, or as complex as a word processor or a spreadsheet.
The 'client' is used in client-server environment to refer to the program the person uses to run the application. A client-server environment is one in which multiple computers share information such as entering information into a database. The 'client' is the application used to enter the information, and the 'server' is the application used to store the information,
Web applications commonly use a combination of server-side script (ASP, PHP, etc) and client-side script (HTML, Javascript, etc.) to develop the application.
Server-side web apps can be written in any language which can output text. All that's required is that there is some way for a web server (as in the server software, e.g. Apache) to run the script so that it can send the output to the requesting browser. If that output is valid HTML then brilliant, a web page can be rendered
Web app consists of a server and a client side. Server side can be written in a any programming language. It would be convenient if the language and the libraries support web development. On the client side the norm is web standards like JavaScript, html and css.
A web app is an app coded in any or many of the laguanges of the web, i.e. html, css, javascript, php, asp.net etc. Web apps can be run in a regular browser, in a mobile browser or can be wrapped as apps to be downloaded from Android Market, AppStore etc.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I've been wondering to try out server-side javascript for a while. And I'm finding a good amount of servers, like:
Node.js Rhino SpiderMonkey among others.
Could anyone with experience on server-side javascript, tell me which are the best engines? and why? I like the Node.js because it's based on Google's V8 engine. And seems easy to use. But some feedback on what you would choose would be great.
Edit:
Some benchmarks for Node.
I'm thinking on going with this one but feedback is still welcome.
Thanks
I think each solution has its own advantages/disadvantages
here a list of SSJS solutions:
Aptana Jaxer:
sadly abandoned
Sitepoint Persevere:
based on rhino -
include JSDB, supports JSON Query -
by Kris Zyp, the author of JSON Schema
RingoJS:
based on rhino -
ex Helma NG successor of Helma which existed from long time ago -
multi-thread -
nice community -
great actor on CommonJS
Narwhal:
can work on either spidermonkey, V8, or webkit JavaScriptCore -
another great actor on CommonJS -
defined the JSGI API in the Jack Server
Joyent NodeJS:
based on V8
(fast) -
all is running in a single thread -
all the code must be written using callbacks -
lot of modules available via npm (Node Package Manager)
4D Wakanda:
based on Webkit JavaScriptCore aka SFX or Nitro (which has been faster than V8 and could be faster again) -
include an NoSQL Object oriented JavaScript datastore with a native REST API -
multi-threaded -
provides a studio with a debugger, a Model Designer, and a GUI Designer -
provides a Framework with Widgets directly bindable to the datastore and between each others
APE project: based on spidermonkey - a Push engine to synchronize in live data between many visitor browsers
10gen MongoDB: A NoSQL Document store allowing code in either Erlang & JavaScript (using spidermonkey)
Apache CouchDB: Another NoSQL Document store also allowing code in either Erlang & JavaScript (using spidermonkey)
See a Server-Side JavaScript presentation with some history, benchmarks, & descriptions
The word server is badly used. Those are different JavaScript implementations.
Personally the only thing I'm doubtful about these implementations is about the low amount of system libraries. Most of them come with standard stuff (sockets, filesystem etc..) but lack support for Threads and concurrency. That's why I usually use Rhino, unless I care for speed.
It might help to describe what problem you are trying to solve. There are a lot of "server-side" JS implementations that fill various needs. An there also several "server" platforms built around these implementations. I wrote one implementation on top of Rhino and Java Servlets, called Myna. Myna is for web applications, and I detailed some of its advantages in another question.
Are you trying to deploy web applications? Are you trying to script existing code? Does your code need to start quickly from a commandline, or is it going to be implemented as a daemon?
There are currently no clear winners in this space that do all of these things well, but there are good choices for specific needs.