Node.js is an introduction to the Node.js platform for developing server-side JavaScript applications. It discusses Node.js background and architecture, JavaScript basics, installing Node.js and setting up a development environment. It then demonstrates building a simple web application using Express and connecting it to MongoDB. The document provides an overview of Node.js advantages like asynchronous non-blocking I/O and event-driven model that make it well-suited for real-time applications and APIs.
Learn how to build RESTful API using Node JS with Express Js Framework. Database used is Mongo DB (Mongoose Library). Learn Step by step what is Node JS, Express, API and Mongo DB. Explain and sample code step to build RESTful API
Learn how to build RESTful API using Node JS with Express Js Framework. Database used is Mongo DB (Mongoose Library). Learn Step by step what is Node JS, Express, API and Mongo DB. Explain and sample code step to build RESTful API
What is Node.js | Node.js Tutorial for Beginners | Node.js Modules | Node.js ...Edureka!
This Edureka "What is Node.js" tutorial will help you to learn the Node.js fundamentals and how to create an application in Node.js. Node.js is an open-source, cross-platform JavaScript runtime environment for developing a diverse variety of server tools and applications. Below are the topics covered in this tutorial:
1) Client Server Architecture
2) Limitations of Multi – Threaded Model
3) What is Node.js?
4) Features of Node.js
5) Node.js Installation
6) Blocking Vs. Non – Blocking I/O
7) Creating Node.js Program
8) Node.js Modules
This is the slide deck from the popular "Introduction to Node.js" webinar with AMD and DevelopIntelligence, presented by Joshua McNeese. Watch our AMD Developer Central YouTube channel for the replay at https://www.youtube.com/user/AMDDevCentral.
This is an introduction to NodeJS which is an open-source, cross-platform run-time environment for developing server-side Web Applications. It also discusses the implications of NodeJS in Internet of Things (IoT).
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...Edureka!
This Edureka "Node.js tutorial" will help you to learn the Node.js fundamentals and how to create an application in Node.js. Node.js is an open-source, cross-platform JavaScript runtime environment for developing a diverse variety of server tools and applications. Below are the topics covered in this tutorial:
1) Client Server Architecture
2) Limitations of Multi-Threaded Model
3) What is Node.js?
4) Features of Node.js
5) Node.js Installation
6) Blocking Vs. Non – Blocking I/O
7) Creating Node.js Program
8) Node.js Modules
9) Demo – Grocery List Web Application using Node.js
I talked about Vue.js at @agenciasomadev. In this talk I showed the basics about the Vue.js JavaScript Framework and it's simplicity. I hope you enjoy :)
NodeJS is an open source, cross platform run time environment for server side and networking application. NodeJS is popular in development because front & back end side both uses JavaScript Code.
Come see how easy it is to build fast, accurate, and responsive web UIs using the React library. Even if you’ve never written Javascript before, React’s straightforward syntax can get you started with your UI project quickly. In this session, you’ll learn about React’s declarative syntax and state representation, explore some of the basic components that are used to build sophisticated UIs, and leave with a foundational application you can continue to build on.
What is Node.js | Node.js Tutorial for Beginners | Node.js Modules | Node.js ...Edureka!
This Edureka "What is Node.js" tutorial will help you to learn the Node.js fundamentals and how to create an application in Node.js. Node.js is an open-source, cross-platform JavaScript runtime environment for developing a diverse variety of server tools and applications. Below are the topics covered in this tutorial:
1) Client Server Architecture
2) Limitations of Multi – Threaded Model
3) What is Node.js?
4) Features of Node.js
5) Node.js Installation
6) Blocking Vs. Non – Blocking I/O
7) Creating Node.js Program
8) Node.js Modules
This is the slide deck from the popular "Introduction to Node.js" webinar with AMD and DevelopIntelligence, presented by Joshua McNeese. Watch our AMD Developer Central YouTube channel for the replay at https://www.youtube.com/user/AMDDevCentral.
This is an introduction to NodeJS which is an open-source, cross-platform run-time environment for developing server-side Web Applications. It also discusses the implications of NodeJS in Internet of Things (IoT).
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...Edureka!
This Edureka "Node.js tutorial" will help you to learn the Node.js fundamentals and how to create an application in Node.js. Node.js is an open-source, cross-platform JavaScript runtime environment for developing a diverse variety of server tools and applications. Below are the topics covered in this tutorial:
1) Client Server Architecture
2) Limitations of Multi-Threaded Model
3) What is Node.js?
4) Features of Node.js
5) Node.js Installation
6) Blocking Vs. Non – Blocking I/O
7) Creating Node.js Program
8) Node.js Modules
9) Demo – Grocery List Web Application using Node.js
I talked about Vue.js at @agenciasomadev. In this talk I showed the basics about the Vue.js JavaScript Framework and it's simplicity. I hope you enjoy :)
NodeJS is an open source, cross platform run time environment for server side and networking application. NodeJS is popular in development because front & back end side both uses JavaScript Code.
Come see how easy it is to build fast, accurate, and responsive web UIs using the React library. Even if you’ve never written Javascript before, React’s straightforward syntax can get you started with your UI project quickly. In this session, you’ll learn about React’s declarative syntax and state representation, explore some of the basic components that are used to build sophisticated UIs, and leave with a foundational application you can continue to build on.
This presentation provides a brief overview on becoming a member of the Node.js Foundation. For more information, visit https://nodejs.org/en/foundation/members/.
Introduction to node js - From "hello world" to deploying on azureColin Mackay
Slide deck from my talk on Node.js.
More information is available here: http://colinmackay.scot/2014/11/29/dunddd-2014-introduction-to-node-jsfrom-hello-world-to-deploying-on-azure/
Get on board the NodeJS Express as we take a journey through what makes NodeJS special. Server-side JavaScript that has an event loop for a heart, we'll delve into its single threaded nature and the advantages provided. From there we'll pass through the land of the Node Package Management tool, how to set up your own package and bring in useful 3rd party packages as dependencies. Our final destination is ExpressJS, a Sinatra inspired framework for NodeJS.
The Node.js movement has transformed the landscape of UI development. In this session we'll look at how Node.js can be leveraged on multiple layers of the web application development lifecycle. Attendees will learn how incorporating Node.js into your front-end build process can optimize code, allow you to use use new and upcoming JavaScript features in your code today, and to improve your asset delivery pipeline. This session will also cover how Node is changing the template rendering landscape, allowing developers to write "isomorphic" code that runs on the client and server. Lastly we'll look into using Node to achieve developer zen by keeping the codebase clean and limiting the risk of changes to the code causing unknown errors.
Sam Roberts, Team Lead, StrongLoop and API Connect, IBM @octetcloud and Michael Dawson, Software
Developer, IBM @mhdawson1
You’ll have some captive Node.js/V8 collaborators, and you can ask them anything! Confused about the
LTS plans, wondering what is happening in the Node workgroups, want to know what is really going to
happen with Webworkers, what’s the future of Promises in Node.js? Wondering how to debug your
production failures? Ask us anything, and we’ll try and answer!
Building A Web App In 100% JavaScript with Carl BergenhemFITC
Save 10% off ANY FITC event with discount code 'slideshare'
See our upcoming events at www.fitc.ca
OVERVIEW
We all love and adore JavaScript when we use it on the front-end of our web apps – why not use it in the back-end as well? That’s like having your cake and eating it too! Prepare to have your mind blown, because in this presentation we will create an entire web application using just (or well, mostly) JavaScript. Learn how to create a fast and flexible back-end utilizing the popular Node.js library and see how it ties in with your UI. From accessing the database to handling interactions with the front-end – we’ll do it all!
Business considerations for node.js applicationsAspenware
Node.js is one of the newest and most exciting open web technologies to surface in the last few years. This presentation explores considerations for business stakeholders and technology decision-makers looking to switch their existing stacks to Node.js. Mike examines questions like: What is Node.js? What are the benefits from using Node.js? What are the drawbacks? Who is using this technology today? In a world of people demanding responsive, real-time applications, Node.js makes a compelling argument for change. Mike includes case studies from companies like LinkedIn and Yammer to illustrate the business cases that make sense.
About Node.js:
Node.js (Node) , the brain child of Ryan Dahl, was released in 2009 when he worked for Joyent, Inc. Node is one of the most hyped technologies to arrive on the web development scene, though it is also one of the most misunderstood.
So what is Node? Is it a programming language like Python, Java, or C++? Is it an application framework like Django, Rails, or Symphony? Is it maybe some type of middleware that can be plugged into existing web stacks like Memcached or RabbitMQ? Actually, it is none of the above. Node is simply a set of JavaScript language bindings to Google's powerful V8 engine. This begs the question: "what is a language binding and what is V8?"
We are a passionate group of youngsters with the aim to deliver secure and creative solutions for currently prevailing obstacles and to avert future ones. Our solutions make sure your resources are efficiently worn and efforts are simple. We are start-ups confined to no boundaries. Hit us with your problems and we will bounce back with solutions. We welcome error pointed and feedback to serve you better. Our support team is available 24X7 to put a smile on you and keep your clients happy.
An overview and start with Node.js.
Node.js Timeline
Why Node.js
Synchronous vs. Asynchronous
Advantages
Handles A File Request
Node.js File
Practical Task
IDE
Download and Install
Hello World
Demo Tasks
Create A Module
Books References
Web References
“Node's goal is to provide an easy way to build scalable Network programs”
Asynchronous i/o framework
Core in c++ on top of v8
Rest of it in javascript
Swiss army knife for network Related stuffs
Can handle thousands of Concurrent connections with Minimal overhead (cpu/memory) on a single process
It’s NOT a web framework, and it’s also NOT a language
• Created by Ryan Dahl in 2009
• Development && maintenance sponsored by Joyent
• License MIT
• Last release : 0.10.31
• Based on Google V8 Engine
• +99 000 packages
A quick overview on Node.js to see how Javascript is changing server programming : brief history & motivations, what makes NodeJS so special/popular/difficult, typical use cases, and a few popular tools around the NodeJs world : npm, Grunt, IISNode, Tools for Visual Studio, …
An introduction into Node as a programming platform. This presentation introduces Node - its history, its architecture, the eco system of npm modules and tools and its place in the enterprise IT architecture and infrastructure. The Express framework is introduced, some core modules, the notion of asynchronous operations and the use of module async and of the ES6 Promises. Server Sent Events are introduced for a server to client push application. The interaction with MongoDB is demonstrated. The presentation contains many code samples. Note that the presentation is associated with sources and workshop materials in GitHub: https://github.com/lucasjellema/nodejs-introduction-workshop-may2017 .
Enhancing Research Orchestration Capabilities at ORNL.pdfGlobus
Cross-facility research orchestration comes with ever-changing constraints regarding the availability and suitability of various compute and data resources. In short, a flexible data and processing fabric is needed to enable the dynamic redirection of data and compute tasks throughout the lifecycle of an experiment. In this talk, we illustrate how we easily leveraged Globus services to instrument the ACE research testbed at the Oak Ridge Leadership Computing Facility with flexible data and task orchestration capabilities.
Globus Connect Server Deep Dive - GlobusWorld 2024Globus
We explore the Globus Connect Server (GCS) architecture and experiment with advanced configuration options and use cases. This content is targeted at system administrators who are familiar with GCS and currently operate—or are planning to operate—broader deployments at their institution.
Code reviews are vital for ensuring good code quality. They serve as one of our last lines of defense against bugs and subpar code reaching production.
Yet, they often turn into annoying tasks riddled with frustration, hostility, unclear feedback and lack of standards. How can we improve this crucial process?
In this session we will cover:
- The Art of Effective Code Reviews
- Streamlining the Review Process
- Elevating Reviews with Automated Tools
By the end of this presentation, you'll have the knowledge on how to organize and improve your code review proces
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Mind IT Systems
Healthcare providers often struggle with the complexities of chronic conditions and remote patient monitoring, as each patient requires personalized care and ongoing monitoring. Off-the-shelf solutions may not meet these diverse needs, leading to inefficiencies and gaps in care. It’s here, custom healthcare software offers a tailored solution, ensuring improved care and effectiveness.
First Steps with Globus Compute Multi-User EndpointsGlobus
In this presentation we will share our experiences around getting started with the Globus Compute multi-user endpoint. Working with the Pharmacology group at the University of Auckland, we have previously written an application using Globus Compute that can offload computationally expensive steps in the researcher's workflows, which they wish to manage from their familiar Windows environments, onto the NeSI (New Zealand eScience Infrastructure) cluster. Some of the challenges we have encountered were that each researcher had to set up and manage their own single-user globus compute endpoint and that the workloads had varying resource requirements (CPUs, memory and wall time) between different runs. We hope that the multi-user endpoint will help to address these challenges and share an update on our progress here.
OpenMetadata Community Meeting - 5th June 2024OpenMetadata
The OpenMetadata Community Meeting was held on June 5th, 2024. In this meeting, we discussed about the data quality capabilities that are integrated with the Incident Manager, providing a complete solution to handle your data observability needs. Watch the end-to-end demo of the data quality features.
* How to run your own data quality framework
* What is the performance impact of running data quality frameworks
* How to run the test cases in your own ETL pipelines
* How the Incident Manager is integrated
* Get notified with alerts when test cases fail
Watch the meeting recording here - https://www.youtube.com/watch?v=UbNOje0kf6E
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Crescat
Crescat is industry-trusted event management software, built by event professionals for event professionals. Founded in 2017, we have three key products tailored for the live event industry.
Crescat Event for concert promoters and event agencies. Crescat Venue for music venues, conference centers, wedding venues, concert halls and more. And Crescat Festival for festivals, conferences and complex events.
With a wide range of popular features such as event scheduling, shift management, volunteer and crew coordination, artist booking and much more, Crescat is designed for customisation and ease-of-use.
Over 125,000 events have been planned in Crescat and with hundreds of customers of all shapes and sizes, from boutique event agencies through to international concert promoters, Crescat is rigged for success. What's more, we highly value feedback from our users and we are constantly improving our software with updates, new features and improvements.
If you plan events, run a venue or produce festivals and you're looking for ways to make your life easier, then we have a solution for you. Try our software for free or schedule a no-obligation demo with one of our product specialists today at crescat.io
Essentials of Automations: The Art of Triggers and Actions in FMESafe Software
In this second installment of our Essentials of Automations webinar series, we’ll explore the landscape of triggers and actions, guiding you through the nuances of authoring and adapting workspaces for seamless automations. Gain an understanding of the full spectrum of triggers and actions available in FME, empowering you to enhance your workspaces for efficient automation.
We’ll kick things off by showcasing the most commonly used event-based triggers, introducing you to various automation workflows like manual triggers, schedules, directory watchers, and more. Plus, see how these elements play out in real scenarios.
Whether you’re tweaking your current setup or building from the ground up, this session will arm you with the tools and insights needed to transform your FME usage into a powerhouse of productivity. Join us to discover effective strategies that simplify complex processes, enhancing your productivity and transforming your data management practices with FME. Let’s turn complexity into clarity and make your workspaces work wonders!
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus
As part of the DOE Integrated Research Infrastructure (IRI) program, NERSC at Lawrence Berkeley National Lab and ALCF at Argonne National Lab are working closely with General Atomics on accelerating the computing requirements of the DIII-D experiment. As part of the work the team is investigating ways to speedup the time to solution for many different parts of the DIII-D workflow including how they run jobs on HPC systems. One of these routes is looking at Globus Compute as a way to replace the current method for managing tasks and we describe a brief proof of concept showing how Globus Compute could help to schedule jobs and be a tool to connect compute at different facilities.
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Łukasz Chruściel
No one wants their application to drag like a car stuck in the slow lane! Yet it’s all too common to encounter bumpy, pothole-filled solutions that slow the speed of any application. Symfony apps are not an exception.
In this talk, I will take you for a spin around the performance racetrack. We’ll explore common pitfalls - those hidden potholes on your application that can cause unexpected slowdowns. Learn how to spot these performance bumps early, and more importantly, how to navigate around them to keep your application running at top speed.
We will focus in particular on tuning your engine at the application level, making the right adjustments to ensure that your system responds like a well-oiled, high-performance race car.
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxrickgrimesss22
Discover the essential features to incorporate in your Winzo clone app to boost business growth, enhance user engagement, and drive revenue. Learn how to create a compelling gaming experience that stands out in the competitive market.
We describe the deployment and use of Globus Compute for remote computation. This content is aimed at researchers who wish to compute on remote resources using a unified programming interface, as well as system administrators who will deploy and operate Globus Compute services on their research computing infrastructure.
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisGlobus
JASMIN is the UK’s high-performance data analysis platform for environmental science, operated by STFC on behalf of the UK Natural Environment Research Council (NERC). In addition to its role in hosting the CEDA Archive (NERC’s long-term repository for climate, atmospheric science & Earth observation data in the UK), JASMIN provides a collaborative platform to a community of around 2,000 scientists in the UK and beyond, providing nearly 400 environmental science projects with working space, compute resources and tools to facilitate their work. High-performance data transfer into and out of JASMIN has always been a key feature, with many scientists bringing model outputs from supercomputers elsewhere in the UK, to analyse against observational or other model data in the CEDA Archive. A growing number of JASMIN users are now realising the benefits of using the Globus service to provide reliable and efficient data movement and other tasks in this and other contexts. Further use cases involve long-distance (intercontinental) transfers to and from JASMIN, and collecting results from a mobile atmospheric radar system, pushing data to JASMIN via a lightweight Globus deployment. We provide details of how Globus fits into our current infrastructure, our experience of the recent migration to GCSv5.4, and of our interest in developing use of the wider ecosystem of Globus services for the benefit of our user community.
E-commerce Application Development Company.pdfHornet Dynamics
Your business can reach new heights with our assistance as we design solutions that are specifically appropriate for your goals and vision. Our eCommerce application solutions can digitally coordinate all retail operations processes to meet the demands of the marketplace while maintaining business continuity.
2. Agenda
• Intent
• Node JS – Background & Overview
• JS Basics
• Pre-Cursors
• Installation, Setup, IDE & NPM
• JS Basics – callback, blocking & non-blocking I/O
• NodeJS –Modules, simple server
• Node JS Architecture
• Blocking vs. Non-Blocking I/O – Comparison
• Web Application with Express MVC
• Project – Code Structure
• App Development Sequence
• Code Parts – UI Template, Router, Database invocation
• Industry Adoption
• Applicability – Suited / Not Suited for
• Next Session – Topics
3. Intent
• To introduce listeners to the NodeJS platform; discuss the key aspect of non-
blocking I/O; run through a sample web app developed using Express framework
• An hour of glimpsing around NodeJS – Nothing else
Follow-up
Follow-up sessions will extend the sample application to work with files, show case a
socket I/O based file explorer and integrate with NoSQL databases like MongoDB
4. 4
Node JS – Background
• Node.js runs on V8 Javascript Engine
• V8 is Google’s open source engine; written in C++ for Chrome
• Created by Ryan Dahl in 2009 and first published in 2011
• Runs on Linux and Windows
• Development and Maintenance of NodeJS is done by Joyent
• Written in C/C++ (80%) and JavaScript (20%) and it is open source.
Overview
• Node.js is ‘server-side JavaScript’; event-driven async I/O
• Well optimized for high concurrency, high performance and network applications
• Uses an event-driven, non-blocking I/O model.
• Non-blocking I/O happens via JavaScript’s callbacks.
• Programs for Node.js are written in JavaScript [not DOM manipulation like in jQuery]
• Node JS executes in a single threaded fashion
5. 5
Pre-Cursors
• Installation
• From website or
• Homebrew (mac OS) or Synaptic (Ubuntu)
• IDE –
• JetBrains WebStorm 8.0.1 OR
• Sublime Text OR
• Eclipse with nodeclipse
• NPM
• Node Package Manager enables get third party modules
• Two modes
• Global - installs modules c:users356992appdata…
• Local – in the same directory under node_modules
• Works based on package.json in the root folder
• Comes packaged with Node installation
Open Source
Node Repository
6. 6
JavaScript – Basics
s1
s2
s3
s4
s5
• Functions in JavaScript are objects – first class citizens
• Essentially, you can pass a function as a variable to another function call
• Closure
Callbacks are – a
Functional
programming paradigm
Callbacks a.k.a Higher-
Order function
Only the function
definition is passed;
function is not
executed
A closure is an inner
function that has
access to the outer
(enclosing) function’s
variables—scope chain
• When callback is invoked, if there is a ‘this’ reference; it will be ‘undefined’
• Handling ‘this’ in a callback is via JS methods of ‘apply(..)’ or ‘call(..)’ OR
• Have the ‘this’ stored in a variable called ‘self’ and use it.
7. 7
Event Driven Programming – Blocking, Non-Blocking I/O
s1
s2
s3
s4
s5
Traditional I/O
Non-blocking I/O
var result = db.query(“select x,y from tableXY”);
doSomethingWithResult(result); //waits for the result!
doSomethingWithoutResult(); //execution is un-necessarily blocked!
db.query(“select x, y from tableXY”,
function (result){
// gets called once the result is ready!
doSomethingWithResult(result);
});
doSomethingWithoutResult(); //executes without any delay!
Callback on db query
completion event
8. 8
Fundamentals – Modules, Sample Code
• Modules
• Referenced by file path or file name
• No Global Scope in NodeJS
• Modules are loaded only once
• Libraries in node are packages/modules
Module 1 Module
s5
s1
s2
s3
s4
s1
s2
Global
Scope
Scripts
within a
module
context
• Sample – Web Server in 3 lines
Classic Browser Runtime
Node Runtime & Scope
s3
s4
s5
Loads the ‘http’ module
Function that handles the incoming
requests. Executed by the main
thread of node.
9. Multi-Threaded HTTP Server – Blocking I/O
• On heavy load – we see more threads that leads to more context switching which in turn leads to
more CPU / Memory usage
• Classic discussion on threads vs. events is in Benjamin Erb’s Thesis
[Strongloop, 2014]
10. Node JS Architecture – Non-Blocking I/O
• On heavy load – we see more threads that leads to more context switching which in turn leads to
more CPU / Memory usage
• Classic discussion on threads vs. events is in Benjamin Erb’s Thesis
[Strongloop, 2014]
11. Node JS – Event Loop
• Node is single-threaded
• Follows an event-driven
functional programming
model
• Errors in the main thread
kills the server
• POSIX thread switching is
not costly
Million concurrent connections
http://blog.caustik.com/2012/08/19/node-js-w1m-concurrent-connections/
[www.udemy.com, 2014]
12. Node JS – Event Loop
Client
Event
loop
(main thread)
C++ Thread pool
(worker threads)
Clients send HTTP requests
to Node.js server
An Event-loop is woken up by OS,
passes request and response objects
to the thread-pool
Long-running jobs run
on worker threads
Response is sent
back to main thread
via callback
Event loop returns
result to client
• Node is single-threaded
• Follows an event-driven
functional programming
model
• Errors in the main thread
kills the server
Million concurrent connections
http://blog.caustik.com/2012/08/19/node-js-w1m-concurrent-connections/
13. Java vs. NodeJS –Performance [ Return data with constant sleep]
Java Stack & Description
• Java servlet returns ‘hello world’ with a
200ms sleep [ simulating a 200ms DB call]
• Executed in Apache Tomcat 6.0, JDK 6
• Tomcat runs in a multi-threaded mode &
in a blocking mode
Node v 0.10
• Returns a ‘hello world’ equivalent string
with a 200ms timeout set in call
• Node JS ran in the (defacto) non-blocking
mode
Not a comparison between Java vs. Node –
rather a comparison of blocking and non-
blocking I/O
14. Node JS – Run Sample Web Application
• Use cases we will see
• Get the list of players from NoSQL (MongoDB)
• Add a player to the list
• STEP 1 – setup
• Install Node
• Install Express
• Install Expres – Genertor
• Generate a node express project
• Install MongoDB
• STEP 2 – Package.json edit to suit your needs
• STEP 3 – Install dependencies
• STEP 4 – Run
d:nodejs> npm install express
d:nodejs> npm install express-generator
d:nodejs> express playerlist
d:nodejsplayerlist> npm install
d:nodejsplayerlist> npm start
15. Node JS – Project Structure
Jade HTML Preprocessor
Express Engine
Mongo DB
Monk
Node.js Server
d:nodejs> npm install express
d:nodejs> npm install express-generator
d:nodejs> express playerlist
V
M
C
Public images, CSS and JS files
URI routing; view attachment
View templates using Jade.
Multiple other options exists – ejs, jade
Mongo DB Data files
• Jade – Template engine. Very short syntax to create a HTML
• Monk – Small layer that enables MongoDB a super-easy task within NodeJS
16. Node JS – Code Parts – MVC
1) Import necessary modules
2) Initialize Express
3) Configure the express app
a. Logger
b. Views
c. Template engine
d. Static images directory
e. …
4) Configure the router
5) Router = Controller
a. Connects the model, jade view
b. Enables navigation across the URIs
17. Node JS – UI Template
• Jade is a server side templating engine – like Thymeleaf, JSP, ASP
• Short syntax to create HTML
18. Node JS – Code Parts contd.
• Router
• Database
View: Jade template name
View Model: “Model of the view”
JSON object passed to the view
1
2
3
Load ‘Mongo’, ‘Monk’ necessary to
connect to MongoDB
Put the Mongo DB reference handle
to the global request object
db.get - Monk APIs to fetch
db.insert,db.find({},fn)
are some of the other relevant APIs
19. Node JS – Deployment
• Simplistic – Newbie mode
• node server.js
• Command line execution. No restart; or no monitoring
• Dies with the command shell closing
• Little better
• node server.js &
• Running as a background application in *nix
• Will last than the shell that started it
• Script that loops & restarts the server
• Still limited the lifeline of the script that starts
• Improvised shell
• Cron based monitoring
• Log attached
• Auto start enabled
• External port monitoring enabled for load balancing
While :
do
// node server.js
// sleep x seconds
done
// description
// author
// specify port, Ethernet card
// attach a cron job – for every minute
// start in sudo mode
// ensure a log file is rolled
// attached the init.d in linux
20. 20
Industry Adoption
Paypal’s Account Overview via NodeJS
• Timeline & Inventory
• Built twice as fast as the Java Application
• 33% fewer lines of code – compared to the same functionality in
Java /Spring
• 40% fewer files
• Performance
• Double the requests vs. Java Application
• 35% decrease in the average response time
• Essentially, page loading is faster than the Java App
• Stack
• NodeJS – Server
• KrakenJS – Secure and scalable layer that extends Express, which
provides convention
• Dust – Asynchronous templates
21. 21
Pros & Cons
Pros
• Fast – Execution speed
• Faster to market – development speed
• Less lines of code
• Great community
• Proven with high volume systems
• Most suited for networking, I/O intensive applications
Cons
• Writing event driven code is complex compared to
synchronous code
• Writing a large business logic centric system is cumbersome
• Callback hell
• Exception handling is not straight forward
22. 22
Suitability
Suitable Scenarios
• Most suited for networking, I/O intensive applications
• Applications that need high concurrency / Queued concurrent inputs
• Streaming Applications – like Chat servers
• Proxy Service
• Real time applications
• Monitoring Dashboards
• like Brokerage Dashboard (Node JS + Socket IO)
• Application Monitoring
• REST APIs
Not Suited For
• Large business logic centric systems
• Heavy server side computation is required
28. Why Node JS is faster [ Return data with constant sleep]
• Asynchronous Non-blocking I/O is the
root cause
• Not just I/O alone – all of node js 50k
modules are written in an async fashion
• Debuggers, monitors, loggers,
• Cluster manager
• File operation
• Java NIO alone is not enough