This document outlines an introductory course on learning node.js. It includes an introduction, schedule, today's agenda, explanations of what node.js is and how it is used, essential JavaScript knowledge required, useful development tools, core node.js concepts like events and streams, asynchronous programming, useful libraries, exercises for students, and references for further learning. The goal is to provide students with an understanding of node.js and hands-on experience building simple applications.
An absolute beginners guide to node.js . Done for a presentation at college. The presentation contains data from various sources ,sources are noted at the end slide. please inform me any mistakes ,since at that time i was in a bit of hurry :)
Fundamental of Node.JS - Internship Presentation - Week7Devang Garach
Fundamental of Node.JS - Internship Presentation - Week 7
What is Node.JS
Features of Node.JS
Node.JS Architecture
Core modules in Node.JS
Node.JS Installation
npm
Creating first node.js application
3 Things Everyone Knows About Node JS That You Don'tF5 Buddy
Node.js is server side javascript. Here the complete presentation on Node JS with the 3 Things which everyone knows about Node JS and installation process of it. https://www.f5buddy.com
An absolute beginners guide to node.js . Done for a presentation at college. The presentation contains data from various sources ,sources are noted at the end slide. please inform me any mistakes ,since at that time i was in a bit of hurry :)
Fundamental of Node.JS - Internship Presentation - Week7Devang Garach
Fundamental of Node.JS - Internship Presentation - Week 7
What is Node.JS
Features of Node.JS
Node.JS Architecture
Core modules in Node.JS
Node.JS Installation
npm
Creating first node.js application
3 Things Everyone Knows About Node JS That You Don'tF5 Buddy
Node.js is server side javascript. Here the complete presentation on Node JS with the 3 Things which everyone knows about Node JS and installation process of it. https://www.f5buddy.com
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/
Node js is said to be an open source. It is the cross-platform JavaScript runtime to developing different types of applications and tools. Thus the best node js course js is not a JavaScript framework with its many of the core modules which are mainly written in the JavaScript and even the developers to writing a new module. It is also primarily used to develop the input and output web applications like single page applications, video streaming sites with other web applications.
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
My Node.js workshop from Sela's Developer Conference 2015.
In the Workshop we covered The basics Node.js api's and the express web application framework.
These are the slides that were used for my presentation on Node.js in OpenSlava 2013 (October 11th, 2013, Bratislava) and provide an introduction to Node.js as well as analyze the potential effects of introducing Node.js in an enterprise and from an architectural perspective.
Nodejs Event Driven Concurrency for Web ApplicationsGanesh Iyer
We describe the event-driven concurrency model used by Nodejs, a JavaScript server-side scripting platform. An overview of the traditional thread based approach(used by Apache) is also given. We compare both the approaches. An Introduction to Nodejs programming is provided and some useful packages are discussed.
node.js 실무 - node js in practice by Jesang YoonJesang Yoon
Sharing 4 years of experience about node.js - A google chrome V8 engine javascript based web server technology. This slide covers about wide range of knowledge about node.js learned from 4 years of production, experiment, test & failures
4년 동안 node.js 서버 프로그래밍을 경험한 내용을 간략하게 정리해 보았습니다. node.js 를 접하시는 분들에게 도움이 되었으면 합니다.
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/
Node js is said to be an open source. It is the cross-platform JavaScript runtime to developing different types of applications and tools. Thus the best node js course js is not a JavaScript framework with its many of the core modules which are mainly written in the JavaScript and even the developers to writing a new module. It is also primarily used to develop the input and output web applications like single page applications, video streaming sites with other web applications.
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
My Node.js workshop from Sela's Developer Conference 2015.
In the Workshop we covered The basics Node.js api's and the express web application framework.
These are the slides that were used for my presentation on Node.js in OpenSlava 2013 (October 11th, 2013, Bratislava) and provide an introduction to Node.js as well as analyze the potential effects of introducing Node.js in an enterprise and from an architectural perspective.
Nodejs Event Driven Concurrency for Web ApplicationsGanesh Iyer
We describe the event-driven concurrency model used by Nodejs, a JavaScript server-side scripting platform. An overview of the traditional thread based approach(used by Apache) is also given. We compare both the approaches. An Introduction to Nodejs programming is provided and some useful packages are discussed.
node.js 실무 - node js in practice by Jesang YoonJesang Yoon
Sharing 4 years of experience about node.js - A google chrome V8 engine javascript based web server technology. This slide covers about wide range of knowledge about node.js learned from 4 years of production, experiment, test & failures
4년 동안 node.js 서버 프로그래밍을 경험한 내용을 간략하게 정리해 보았습니다. node.js 를 접하시는 분들에게 도움이 되었으면 합니다.
Dart is a new language for the web, enabling you to write JavaScript on a secure and manageable way. No need to worry about "JavaScript: The bad parts".
This presentation concentrates on the developer experience converting from the Java based GWT to Dart.
A broad introduction to Java.
What is Java and where is it used
Programming Languages in the web development
What is Java and where is it used
OOP PRINCIPLES
JAVA SE, JRE, JDK
IDE’s
Where Java used in the “Real World”
How do we go from your Java code to the CPU assembly that actually runs it? Using high level constructs has made us forget what happens behind the scenes, which is however key to write efficient code.
Starting from a few lines of Java, we explore the different layers that constribute to running your code: JRE, byte code, structure of the OpenJDK virtual machine, HotSpot, intrinsic methds, benchmarking.
An introductory presentation to these low-level concerns, based on the practical use case of optimizing 6 lines of code, so that hopefully you to want to explore further!
Presentation given at the Toulouse (FR) Java User Group.
Video (in french) at https://www.youtube.com/watch?v=rB0ElXf05nU
Slideshow with animations at https://docs.google.com/presentation/d/1eIcROfLpdTU2_Z_IKiMG-AwqZGZgbN1Bs2E0nGShpbk/pub?start=true&loop=false&delayms=60000
Rapid, Scalable Web Development with MongoDB, Ming, and PythonRick Copeland
In 2009, SourceForge embarked on a quest to modernize our websites, converting a site written for a hodge-podge of relational databases in PHP to a MongoDB and Python-powered site, with a small development team and a tight deadline. We have now completely rewritten both the consumer and producer parts of the site with better usability, more functionality and better performance. This talk focuses on how we're using MongoDB, the pymongo driver, and Ming, an ORM-like library implemented at SourceForge, to continually improve and expand our offerings, with a special focus on how3 anyone can quickly become productive with Ming and pymongo without having to apologize for poor performance.
Similar to Node.js Course 1 of 2 - Introduction and first steps (20)
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Shahin Sheidaei
Games are powerful teaching tools, fostering hands-on engagement and fun. But they require careful consideration to succeed. Join me to explore factors in running and selecting games, ensuring they serve as effective teaching tools. Learn to maintain focus on learning objectives while playing, and how to measure the ROI of gaming in education. Discover strategies for pitching gaming to leadership. This session offers insights, tips, and examples for coaches, team leads, and enterprise leaders seeking to teach from simple to complex concepts.
Experience our free, in-depth three-part Tendenci Platform Corporate Membership Management workshop series! In Session 1 on May 14th, 2024, we began with an Introduction and Setup, mastering the configuration of your Corporate Membership Module settings to establish membership types, applications, and more. Then, on May 16th, 2024, in Session 2, we focused on binding individual members to a Corporate Membership and Corporate Reps, teaching you how to add individual members and assign Corporate Representatives to manage dues, renewals, and associated members. Finally, on May 28th, 2024, in Session 3, we covered questions and concerns, addressing any queries or issues you may have.
For more Tendenci AMS events, check out www.tendenci.com/events
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.
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Anthony Dahanne
Les Buildpacks existent depuis plus de 10 ans ! D’abord, ils étaient utilisés pour détecter et construire une application avant de la déployer sur certains PaaS. Ensuite, nous avons pu créer des images Docker (OCI) avec leur dernière génération, les Cloud Native Buildpacks (CNCF en incubation). Sont-ils une bonne alternative au Dockerfile ? Que sont les buildpacks Paketo ? Quelles communautés les soutiennent et comment ?
Venez le découvrir lors de cette session ignite
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns
Unlocking Business Potential: Tailored Technology Solutions by Prosigns
Discover how Prosigns, a leading technology solutions provider, partners with businesses to drive innovation and success. Our presentation showcases our comprehensive range of services, including custom software development, web and mobile app development, AI & ML solutions, blockchain integration, DevOps services, and Microsoft Dynamics 365 support.
Custom Software Development: Prosigns specializes in creating bespoke software solutions that cater to your unique business needs. Our team of experts works closely with you to understand your requirements and deliver tailor-made software that enhances efficiency and drives growth.
Web and Mobile App Development: From responsive websites to intuitive mobile applications, Prosigns develops cutting-edge solutions that engage users and deliver seamless experiences across devices.
AI & ML Solutions: Harnessing the power of Artificial Intelligence and Machine Learning, Prosigns provides smart solutions that automate processes, provide valuable insights, and drive informed decision-making.
Blockchain Integration: Prosigns offers comprehensive blockchain solutions, including development, integration, and consulting services, enabling businesses to leverage blockchain technology for enhanced security, transparency, and efficiency.
DevOps Services: Prosigns' DevOps services streamline development and operations processes, ensuring faster and more reliable software delivery through automation and continuous integration.
Microsoft Dynamics 365 Support: Prosigns provides comprehensive support and maintenance services for Microsoft Dynamics 365, ensuring your system is always up-to-date, secure, and running smoothly.
Learn how our collaborative approach and dedication to excellence help businesses achieve their goals and stay ahead in today's digital landscape. From concept to deployment, Prosigns is your trusted partner for transforming ideas into reality and unlocking the full potential of your business.
Join us on a journey of innovation and growth. Let's partner for success with Prosigns.
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.
Understanding Globus Data Transfers with NetSageGlobus
NetSage is an open privacy-aware network measurement, analysis, and visualization service designed to help end-users visualize and reason about large data transfers. NetSage traditionally has used a combination of passive measurements, including SNMP and flow data, as well as active measurements, mainly perfSONAR, to provide longitudinal network performance data visualization. It has been deployed by dozens of networks world wide, and is supported domestically by the Engagement and Performance Operations Center (EPOC), NSF #2328479. We have recently expanded the NetSage data sources to include logs for Globus data transfers, following the same privacy-preserving approach as for Flow data. Using the logs for the Texas Advanced Computing Center (TACC) as an example, this talk will walk through several different example use cases that NetSage can answer, including: Who is using Globus to share data with my institution, and what kind of performance are they able to achieve? How many transfers has Globus supported for us? Which sites are we sharing the most data with, and how is that changing over time? How is my site using Globus to move data internally, and what kind of performance do we see for those transfers? What percentage of data transfers at my institution used Globus, and how did the overall data transfer performance compare to the Globus users?
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteGoogle
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
👉👉 Click Here To Get More Info 👇👇
https://sumonreview.com/ai-pilot-review/
AI Pilot Review: Key Features
✅Deploy AI expert bots in Any Niche With Just A Click
✅With one keyword, generate complete funnels, websites, landing pages, and more.
✅More than 85 AI features are included in the AI pilot.
✅No setup or configuration; use your voice (like Siri) to do whatever you want.
✅You Can Use AI Pilot To Create your version of AI Pilot And Charge People For It…
✅ZERO Manual Work With AI Pilot. Never write, Design, Or Code Again.
✅ZERO Limits On Features Or Usages
✅Use Our AI-powered Traffic To Get Hundreds Of Customers
✅No Complicated Setup: Get Up And Running In 2 Minutes
✅99.99% Up-Time Guaranteed
✅30 Days Money-Back Guarantee
✅ZERO Upfront Cost
See My Other Reviews Article:
(1) TubeTrivia AI Review: https://sumonreview.com/tubetrivia-ai-review
(2) SocioWave Review: https://sumonreview.com/sociowave-review
(3) AI Partner & Profit Review: https://sumonreview.com/ai-partner-profit-review
(4) AI Ebook Suite Review: https://sumonreview.com/ai-ebook-suite-review
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfJay Das
With the advent of artificial intelligence or AI tools, project management processes are undergoing a transformative shift. By using tools like ChatGPT, and Bard organizations can empower their leaders and managers to plan, execute, and monitor projects more effectively.
How Recreation Management Software Can Streamline Your Operations.pptxwottaspaceseo
Recreation management software streamlines operations by automating key tasks such as scheduling, registration, and payment processing, reducing manual workload and errors. It provides centralized management of facilities, classes, and events, ensuring efficient resource allocation and facility usage. The software offers user-friendly online portals for easy access to bookings and program information, enhancing customer experience. Real-time reporting and data analytics deliver insights into attendance and preferences, aiding in strategic decision-making. Additionally, effective communication tools keep participants and staff informed with timely updates. Overall, recreation management software enhances efficiency, improves service delivery, and boosts customer satisfaction.
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.
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.
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.
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Globus
Large Language Models (LLMs) are currently the center of attention in the tech world, particularly for their potential to advance research. In this presentation, we'll explore a straightforward and effective method for quickly initiating inference runs on supercomputers using the vLLM tool with Globus Compute, specifically on the Polaris system at ALCF. We'll begin by briefly discussing the popularity and applications of LLMs in various fields. Following this, we will introduce the vLLM tool, and explain how it integrates with Globus Compute to efficiently manage LLM operations on Polaris. Attendees will learn the practical aspects of setting up and remotely triggering LLMs from local machines, focusing on ease of use and efficiency. This talk is ideal for researchers and practitioners looking to leverage the power of LLMs in their work, offering a clear guide to harnessing supercomputing resources for quick and effective LLM inference.
How to Position Your Globus Data Portal for Success Ten Good PracticesGlobus
Science gateways allow science and engineering communities to access shared data, software, computing services, and instruments. Science gateways have gained a lot of traction in the last twenty years, as evidenced by projects such as the Science Gateways Community Institute (SGCI) and the Center of Excellence on Science Gateways (SGX3) in the US, The Australian Research Data Commons (ARDC) and its platforms in Australia, and the projects around Virtual Research Environments in Europe. A few mature frameworks have evolved with their different strengths and foci and have been taken up by a larger community such as the Globus Data Portal, Hubzero, Tapis, and Galaxy. However, even when gateways are built on successful frameworks, they continue to face the challenges of ongoing maintenance costs and how to meet the ever-expanding needs of the community they serve with enhanced features. It is not uncommon that gateways with compelling use cases are nonetheless unable to get past the prototype phase and become a full production service, or if they do, they don't survive more than a couple of years. While there is no guaranteed pathway to success, it seems likely that for any gateway there is a need for a strong community and/or solid funding streams to create and sustain its success. With over twenty years of examples to draw from, this presentation goes into detail for ten factors common to successful and enduring gateways that effectively serve as best practices for any new or developing gateway.
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.
2. Welcome
● Name.
● A brief description of yourself and your
experience.
● What do you know about node.js?
● What do you expect of this course?
3. Monday (3h) Tuesday (3h) Wednesday (2h) Thursday (3h)
Introduction to Node.js
Async and ecosystem
Framework and
Enterprise Tools
DevOps and
Advanced Details
- Node.js Q&A
- Introduction to Frontend
with Angular.js
- Dojo Kata: Hello World
- NodeSchool.io learning
path
Dojo Randori:
Connecting our app
to DB
Dojo Kake:
Introducing Test
with Mocha
Starting a fullstack app with
MEAN or Fountain.js
Full Course Agenda
4. Today’s Agenda
● What is node.js?
● ES6 & basic Javascript Required.
● Tooling.
● Event-Oriented Architecture.
● Node Streams.
● Async Management.
● Useful libraries.
● Dojo Kata Hello REST World with Express.
● Exercise: Learning node.js with NodeSchool.io
5. WHAT is it…
A runtime environment designed to use JavaScript in order to develop
high-performance and low latency applications.
& =
6. Used locally as CLI Tool
Can be used in client side e.g. npm, grunt, … but also in Desktop apps like atom
7. Normally are installed by
$npm install -g bower
Used locally as CLI Tool
Remember!
Only install as global (with
-g flap) the tools used in
more than one situation.
8. Used in Server Side
JavaNode.js PHP
SOURCE
CODE
SOURCE
CODE
SOURCE
CODE
To develop high-performance and low latency applications.
It can run by itself without other pieces.
9. <?php
$books = array(
"Myst: The Book of Atrus",
"Myst: The Book of Ti'ana",
"Myst: The Book of D'ni");
serveBooks($books);
function serveBooks($books) {
echo $html = join($books, ',');
$books = array(); // Intentionally deleted
}
?>
One thread running
let books = [ 'The Fellowship of the Ring',
'The Two Towers',
'The return of the King' ];
function serveBooks() {
let reply = books.join(',');
books = []; // Intentionally deleted
return reply;
}
What happens if we press F5
several times?
10. ES6 & JS Required
It’s highly recommendable to know or study the new Javascript Standard known
as ES6 or ECMAScript 2015.
● Let / Const.
● Classes.
● Arrow Functions.
● Typed Arrays.
● Native Promises.
● ....
See references for more
info about “How to learn
Javascript”.
11. A little bit of Javascript Theory
● Interpreted.
● Weak Typing.
● Overloaded through V8
e.g. modules
But also with...
● OOP.
● Exceptions.
● Inheritance.
● Prototypes.
12. Tooling
Node.js (as many other languages) has lots of tools:
- Package Managers (npm, npm search, yarn, bower,...)
- Specialized frameworks* (express, restify, hapi, koa, sails)
- ORM and DB Connectors (sequelize, mongoose)
- Automation Tools (grunt, gulp, npm)
- Testing Tools & QA (mocha, plato, istambul)
- Multiple Environment managers (nvm)
* all the *.js endings were removed from the names intentionally, we always relate this suffix with frontend libraries.
13. ● Package Managers:
Tools intended to download packages from a definition file instead of download them manually or zip.
e.g. package.json, pom.xml, requirements.txt,...
● Multiple Environment Managers:
Tools that creates alias in order to use different node.js versions (normally through a symlink) e.g. nvm,
gvm, update_alternatives…
● Automation Tools:
Tools that automate repetitive tasks e.g. zip files, change names,...
● Scaffolding Tools:
Tools that generate app skeletons with some code to start from.
Some Useful Dev Tools explained
14. Dev Tools: Java ≈ Node.js
● NPM / YARN ≈ MAVEN Central (public deps downloaded by pom.xml)
● SINOPIA ≈ NEXUS/ARTIFACTORY (private deps downloaded by pom.xml)
● GRUNT / GULP ≈ ANT / MAVEN task/target (build, test, …)
● Express, restify,.. ≈ Spring MVC Framework (helps to build an enterprise app)
● Yeoman ≈ Maven Archetype Plugin (helps to start a project with a seed)
● NVM ≈ update_alternatives (manages multiple SDK versions)
uses a package.json file
uses a Gruntfile.js script
uses a
Gulpfile.js script
has its own CLI to scaffolding
15. Node Streams
All data in node.js can be treated as a Stream. A stream is a data flow received by
chunks. e.g. A file opened, data, buffers,...
● It’s an useful way to manage large volumes of data!
Example: https://github.com/wilk/node-certification/blob/master/src/03-Node_Concepts/stream.js
16. Event Oriented
In node.js lots of its classes inherit from EventEmitter so…
● Attach or detach listeners.
● Extend with our own classes to benefit from this behaviour.
● Communicate different parts of the code with an event.
Example: https://github.com/wilk/node-certification/blob/master/src/03-Node_Concepts/events.js
18. Change Paradigm, brace the async
source: http://www.slideshare.net/JamalOGarro/intro-to-nodejs-49431091
19. Differences between sync and async
Source: http://synsem.com/SyncNotAsync/
WAITING I/O
OTHER TASKS
20. Async Management
There are 4 “main ways” to deal with it:
1. Callback & CPS style with fail first.
2. Promises.
3. Flow Control Libraries.
4. Avoid it (when possible) :).
21. Async Management: Callbacks
The default way, easy to understand, difficult to maintain.
// Using the function
sumSomething(2, 10, replyRest(err,solution) { if err ... })
function sumSomething (arg1, arg2, cb) {
if (arg1>10) {
return (cb({ error:’Too long number’ }) // KO
}
cb(null, arg1+arg2) // OK
}
1 of 4
Typical way of managing
the async, be careful with
more than one level.
22. Async Management: Callbacks
The default way, easy to understand, difficult to maintain.
WRONG
doAsync1(function () {
doAsync2(function () {
doAsync3(function () {
doAsync4(function () {
})
})
})
saveDb1 //lots of code
saveDb2 //lots of code
sendEmail //lots of code
FINE
function saveDb1(arg1, arg2, callback) {
//top-level code
}
function saveDb2(arg1, arg2, callback) {
// top-level code
}
function sendEmail(arg1, arg2, callback) {
//top-level code
}
function businessLogic() {
//uses the above to get the work done
}
1 of 4
23. // Using the function
sumSomething
.then(data => anotherFunction(data))
.then(data => replyRest(data))
.catch(err => replyRestKO(err))
function sumSomething (arg1, arg2) {
return new Promise((resolve, reject) => {
if (arg1>10)
reject({ error:’Too long number’ }) // KO
resolve(arg1+arg2) // KO
})
}
Async Management: Promises
More complex to understand but easy to maintain.
2 of 4
A little more complex but...
could be sended through
layers, nested, ...
24. Async Management: Flow Control Libraries
Easy to understand, easy to apply, difficult to escape from them.
const async = require(‘async’)
async.parallel([
function(callback) {
setTimeout(function() { callback(null, 'one'); }, 200);
},
function(callback) {
setTimeout(function() { callback(null, 'two'); }, 100);
}
],
// optional callback, when all finish
function(err, results) {
// results = ['one','two']
});
First param:
array of functions
Second param:
another cb function
3 of 4
Be careful because they’re
sticky and you’ll always need
it!
25. Async Management: Avoiding it
Not all operations need to be async,...
e.g. https://nodejs.org/api/fs.html#fs_fs_mkdirsync_path_mode
● Some part of the node.js API has duplicated implementations and gives us
the possibility to choose a sync function.
● This is not necessary frequently, just for very specific needs
e.g. app bootstrapping,...
4 of 4
30. Dojo Kata
Hello REST World with Express
1. Starting project with $npm init (private:true -> it prevents the accidental
publication of our code).
2. Creating actions to start.
3. Install deps.
4. Adding .gitignore / .svnignore.
5. Coding!
exercise: https://github.com/Pelirrojo/nodejs-npm-express-basic-with-grunt
31. Dojo Randori
Learning node.js with NodeSchool.io
1. Create a folder for the full lab.
2. $npm install -g learnyounode.
3. make a sub folder for each exercise.
4. run $learnyounode.
5. Choose an exercise from menu and solve it.
6. goTo 4 step :).
32. References
● Node.js Official API
nodejs.org/api
● A free series of eBooks
github.com/getify/You-Dont-Know-JS
● A series of exercises intended to prepare the node.js certification
https://github.com/wilk/node-certification/tree/master/src
● EchoJS: News about JS
echojs.com
● HotJS: another JS interesting blog
hotjs.com
Remember to spend some
time improving your
JavaScript skills. This will
be useful for node.js and
fronted Development!
33. Bibliography
ISBN 9781617290930 Node.js in Practice
ISBN 9781617292576 Node.js in Action, Second Edition
ISBN 9781119962595 Smashing Node.js: JavaScript Everywhere
35. Disclaimer
All product names, logos, and brands are property of their respective owners. All company, product and service names
used in this slide deck are for identification purposes only. Use of these names, logos, and brands does not imply
endorsement.
This slide deck is licensed by