Node.js is a Javascript runtime built on Chrome's V8 Javascript engine
An Asynchronous event-driven Javascript runtime, designed to build Scalable network applications
What is Runetime?
Runtime is where we run or execute our code.
Chrome have a runtime engine javascript named V8 engine.
V8 only in Browser at the time
But
Ryan Dahl Create V8 can run in operating system.
- Create NodeJS in 2009
- Software Developer at joyent
- github.com/ry
- At the time, he want to build web server using event loop, not using thread.
- He has tried using C, Lua, Haskell but has many problems
Ryan Dahl made it possible to use the v8 engine outside of browser
He created the application using C to wrap the v8 engine so that it can be run as an executable, and javascript can be run in the application of course in operating system, called NodeJS.
Characteristics of NodeJS
- Asynchronous & Event Driven
- Non-Blocking
- Single Threaded but Highly Scalable
- Cross Platform
- MIT License
- NPM for package management
Main Features Which is Often Used
- File System
- Buffer (Manage binary file like a transfer file, streaming video, image)
- Http & Https
- REPL (Read Evaluate Print Loop)
- Console
- Crypto
- Zlib
See the more features at official doc API Docs Node js
NodeJS vs PHP
It is different because NodeJS is runtime and PHP is language.
But this is a general comparations that we need to know
PHP | NodeJS | |
---|---|---|
Year Made | 1994 | 2009 |
Engine | Zend Engine | Google's V8 Engine |
Code Execution | Multithread, Synchronous | Single-Thread Asynchronous |
Web Server | Apache / IIS | Runs on its own runtime |
Package Manager | Composer | NPM |
Prerequisite to using NodeJS
- Basic Javascript
- Advanced Javascript (Modern JS / ES6)
System & Software requirement
- Windows / Linux / MacOS
- Code Editor
- Terminal / Command Prompt
This article aims to remember and record what I learned from Belajar NodeJS | 1. Apa Itu NodeJS?
Top comments (0)