Tech Talk Node js Jessica Davis Juan Herrera
- Slides: 14
Tech. Talk: Node. js Jessica Davis, Juan Herrera, Ian Hoyt. Mc. Cullough, Varun Verma
Overview of Node. js ● What is Node. js? ○ ● What is Node. js capable of doing? ○ ○ ● Generating dynamic page content Creating, opening, reading, writing, , deleting, and closing files on the server Collecting form data Adding, deleting, modifying data in your database What operating systems officially support Node. js? ○ ● An open-source, cross-platform Java. Script run-time environment that executes Java. Script code in a computing environment Linux, mac. OS, Microsoft Windows, and more How is Node. js primarily used? ○ To build network programs, like web servers
History of Node. js ● 2009: Originally written by Ryan Dahl ○ ● Created after seeing a file upload progress bar on Flickr ○ ● Had to query the Web server for more information about the file Node. js is a combination of: ○ ○ ○ ● ● Initial release supported on Linux and Mac OS X Google’s V 8 Java. Script engine An event loop A low-level I/O API January 2010: npm was released as a package manager for Node. js June 2011: Node. js was expanded to support more operating systems
Demo A short demo… ● ● ● npm init npm scripts (npm start, npm test) npm install <module> (nodemon) Server code (next slide) Dependencies (package. json)
Demo var http = require('http'); http. create. Server(function (req, res) { res. write. Head(200, {'Content-Type': 'text/html'}); res. end('Hello world!'); }). listen(8000);
Pros ● ● ● Javascript easy to learn for front-end developers Compiles directly into machine code Many resources and support available High support for asynchronous events Handles concurrent requests sequentially in a single thread, using less RAM and system resources
Cons ● Cons ○ The single-threaded design can create bottlenecks when used in tasks with lots of computation ○ Must be careful dealing with exceptions in code, as uncaught ones may “bubble up” to the core node. js loop and crash the program for all requests ○ Coding paradigm is highly reliant on asynchronous callbacks, or functions run after certain functions return, so the scope and dependencies in the code can quickly become confusing, resulting in “callback hell” (need to learn to effective use of Promises in order to counteract this)
Alternatives/Competition Ruby on Rails ● ● Good for flexible databases Worse performance than Node. js Django ● ● Highly Scalable Monolithic, not fit for small apps Flask ● ● Minimalist, easy to learn Not much Asynchronous support Php ● ● SQL integration is very simple, huge existing codebase Not as powerful or flexible as Node. js
Use Cases ● ● ● Good for streaming ○ Audio and Video files ○ Web apps similar to Sound. Cloud & Youtube Specially suited for applications where you want to maintain persistent connection from the browser to server ○ Real-time updates ○ Online games ○ Collaborative tools ○ Chat interfaces ○ Gmail for instance Cases of rapid development due to an extensive NPM ecosystem and ease of configuration Cheaper cloud hosting Desire a highly scalable application Unified Java. Script development platform as it integrates well with Mongo. DB, Angular. JS, & React. JS
Use Cases -Uber: Instantaneous real time updates, non-blocking -Netflix: Handles the real time audio & video streaming efficiently -Linked. In: Efficiency & scale. Servers cut down from 15 to 4, & traffic capacity doubled -NASA: Reduced access time by 300%. This is due to the persistent connection maintained by the server
Use Case Chat Example: Event Driven Apps var app = require('express')(); var http = require('http'). Server(app); var io = require('socket. io')(http); app. get('/', function(req, res){ res. send. File(__dirname + '/index. html'); }); io. on('connection', function(socket){ console. log('an user connected'); socket. on('disconnect', function(){ console. log('user disconnected'); }); http. listen(3000, function(){ console. log('listening on *: 3000'); });
Use Case Chat Example: Event Driven Apps
Any Questions?
Sources/References https: //www. mindinventory. com/blog/pros-and-cons-of-node-js-web-app-development/ https: //www. netguru. com/blog/pros-cons-use-node. js-backend https: //medium. com/the-node-js-collection/why-the-hell-would-you-use-node-js-4 b 053 b 94 ab 8 e https: //www. w 3 schools. com/nodejs_intro. asp https: //en. wikipedia. org/wiki/Node. js#Overview https: //medium. com/@Tech. Magic/nodejs-vs-ruby-on-rails-comparison-2017 -which-is-the-best-for-webdevelopment-9 aae 7 a 3 f 08 bf https: //dzone. com/articles/nodejs-vs-djangois-javascript-better-than-python https: //www. codingdojo. com/blog/choosing-python-web-frameworks
- Miguel herrera maritza herrera
- Herrera esquivel juan ignacio
- Video xxx de juan herrera y mav
- Typedef struct in c
- Reference node and non reference node
- Hamiltonian operator
- Reference node and non reference node
- Struct node int data struct node* next
- Constructive interference example
- Talk, read talk write template
- Amateurs talk strategy professionals talk logistics
- The words use are not
- Jessica san juan
- Low tech assistive technology for communication
- Juan juan studio melina