NODE JS
YAUHENI NIKANOVICH
package ecosystem, npm, is the
largest ecosystem of open source
libraries in the world.
is a JavaScript runtime built
on Chrome's V8 JavaScript
engine.
uses an event-driven, non-blocking I/O
model that makes it lightweight and
efficient.
allows the creation of Web
servers and networking tools
using JavaScript
is the JavaScript execution engine built for Google Chrome
and open-sourced by Google in 2008. Written in C++, V8
compiles JavaScript source code to native machine code
instead of interpreting it in real time.
is a package manager for the JavaScript programming language.
It is the default package manager for the JavaScript runtime
environment NodeJS
It consists of a command line client, also called npm, and an
online database of public packages, called the npm registry
The registry is accessed via the client, and the available packages
can be browsed and searched via the npm website
All APIs of NodeJS library are asynchronous, that is, non-
blocking.
It essentially means a NodeJS based server never waits for an
API to return data.
The server moves to the next API after calling it and a
notification mechanism of Events of NodeJS helps the server
to get a response from the previous API call.
NodeJS allows to create a scalable and fast web server in
simple way by using JavaScript.
Opportunity to write client-side and server-side parts of web
application on your favourite JavaScript sounds appealing!
We will need:
‣ Knowledge of the basics JavaScript language
‣ Installed NodeJS (https://nodejs.org)
‣ Any text redactor / IDE
‣ Terminal
LET'S MAKE A SIMPLE SERVER WITH NODEJS (1/5)
Preparation:
‣ Create project folder
‣ Add server.js to project folder
‣ Install node-router package via npm
LET'S MAKE A SIMPLE SERVER WITH NODEJS (2/5)
‣ Add some code
{
LET'S MAKE A SIMPLE SERVER WITH NODEJS (2/5)
‣ Run our server.js
LET'S MAKE A SIMPLE SERVER WITH NODEJS (3/5)
LET'S MAKE A SIMPLE SERVER WITH NODEJS (4/5)
‣ And check the result in browser
As we can see at network tab, when we call origin.

Browser automatically send GET request to ORIGIN.
According the code if someone sent a request for origin then
NodeJS send back a response with text "Hello!"
Looks fine and easy, isn't it?
YAUHENI NIKANOVICH
Thanks
EMAIL: zhenyanikon@gmail.com
2016

Node js first look - 2016

  • 1.
  • 2.
    package ecosystem, npm,is the largest ecosystem of open source libraries in the world. is a JavaScript runtime built on Chrome's V8 JavaScript engine. uses an event-driven, non-blocking I/O model that makes it lightweight and efficient. allows the creation of Web servers and networking tools using JavaScript
  • 3.
    is the JavaScriptexecution engine built for Google Chrome and open-sourced by Google in 2008. Written in C++, V8 compiles JavaScript source code to native machine code instead of interpreting it in real time.
  • 4.
    is a packagemanager for the JavaScript programming language. It is the default package manager for the JavaScript runtime environment NodeJS It consists of a command line client, also called npm, and an online database of public packages, called the npm registry The registry is accessed via the client, and the available packages can be browsed and searched via the npm website
  • 5.
    All APIs ofNodeJS library are asynchronous, that is, non- blocking. It essentially means a NodeJS based server never waits for an API to return data. The server moves to the next API after calling it and a notification mechanism of Events of NodeJS helps the server to get a response from the previous API call.
  • 6.
    NodeJS allows tocreate a scalable and fast web server in simple way by using JavaScript. Opportunity to write client-side and server-side parts of web application on your favourite JavaScript sounds appealing!
  • 7.
    We will need: ‣Knowledge of the basics JavaScript language ‣ Installed NodeJS (https://nodejs.org) ‣ Any text redactor / IDE ‣ Terminal LET'S MAKE A SIMPLE SERVER WITH NODEJS (1/5)
  • 8.
    Preparation: ‣ Create projectfolder ‣ Add server.js to project folder ‣ Install node-router package via npm LET'S MAKE A SIMPLE SERVER WITH NODEJS (2/5)
  • 9.
    ‣ Add somecode { LET'S MAKE A SIMPLE SERVER WITH NODEJS (2/5)
  • 10.
    ‣ Run ourserver.js LET'S MAKE A SIMPLE SERVER WITH NODEJS (3/5)
  • 11.
    LET'S MAKE ASIMPLE SERVER WITH NODEJS (4/5) ‣ And check the result in browser
  • 12.
    As we cansee at network tab, when we call origin.
 Browser automatically send GET request to ORIGIN. According the code if someone sent a request for origin then NodeJS send back a response with text "Hello!" Looks fine and easy, isn't it?
  • 13.