On Github ShamarKellman / css-mean-presentation
Shamar Kellman
Computer Science Society
http://shamarkellman.github.io/css-mean-presentationPost-Graduate Student UWI
All-round developer
Research in Intelligent Virtual Agents (IVAs)
For more see - http://nodejs.org/industry/
Walmart began using Node.js in 2012. They also stated that 53% of their Black Friday online traffic went to their Node servers with zero downtime.
Yahoo started experimenting with Node back in 2010. At first they just used it for small things like file uploads, and now they use Node to handle nearly 2 million requests per minute. They have noted increases in speed and a simpler development process.
LinkedIn began developing the server side of their mobile app entirely with Node. They were previously using Ruby, but since the switch they have seen huge increases in performance, ranging from 2 to 10 times faster.
PayPal has recently jumped onboard and began migrating some of their Java code to Node. They began experimenting with just their Account Overview page, but once they saw a 35% speed increase and half the amount of time spent on development, they started moving all sites to Node.js.
Node uses only one thread to handle all requests. it actually works out well given the asynchronous nature of Node.
Asynchronous events are executed independently of the main program’s “flow”.
Say, for example, a database query request comes in. Depending on how large the query is, it could take a couple of seconds to return anything. Since there is only one thread, it may seem that nothing else would be able to process while the query is executing.
One of the benefits of Node is its package manager, npm17. Like Ruby has RubyGems and PHP has Composer, Node has npm. npm comes bundled with Node and will let us pull in a number of packages to fulfill our needs.
Packages can extend functionality in Node and this package system is one thing that makes Node so powerful. The ability to have a set of code that you can reuse across all your projects is incredible and makes development that much easier.
Multiple packages can be brought together and intertwined to create a number of complex applications.
var http = require('http'); var server = http.createServer(function (request, response) { response.writeHead(200, {"Content-Type": "text/plain"}); response.end("Hello World\n"); }); server.listen(8000); console.log("Server running at http://127.0.0.1:8000/");
Express is a lightweight platform for building web apps using NodeJS.
a minimal and flexible node.js web application framework
Express hides a lot of the inner workings of Node, which allows you to dive into your application code and get things up and running a lot faster. It’s fairly easy to learn and still gives you a bit of flexibility with its structure. There is a reason it is currently the most popular framework for Node.
var express = require('express'); var app = express(); app.get('/', function (req, res) { res.send('Hello World!'); }); var server = app.listen(3000, function () { var host = server.address().address; var port = server.address().port; console.log('Example app listening at http://%s:%s', host, port); });
named from the word “humongous”
you define your data structure however you want.
You can easily take complex objects and insert them into your database using JSON, XML, BSON, or many other similar formats that are better suited to your application. You can even store PDF documents in certain document databases if the use case ever arises.
{ id: "1234", name: "holly", age: "400", type: "high-elf", address: { city: "rivendell", state: "middle-earth" } }
db.users.insert({ user_id: "bcd001", age: 45, status: "A" })
db.users.find()
db.users.update( { age: { $gt: 25 } }, { $set: { status: "C" } }, { multi: true } )
Angular allows you to build your normal HTML application and then extend your markup to create dynamic components. If you’ve ever made a dynamic web page without Angular, you’ve probably noticed some of the common complications, such as data binding, form validation, DOM event handling, and much more. Angular introduces an all-in-one solution to these problems.
if you change data in your view (HTML files) or in your controller (JavaScript files), the data changes everywhere.
Dependency injection is a method by which we can give an object the dependencies that it requires to run.
var myVar = 0;
var myInt = 0; var myFloat = 2.5; var myBoolean = true; var myString = "This is a string"; var myArray = [1,2,3]; var myJSONObject = { myField : "Some value" }; // Object instantiation using new var myDate = new Date();client
var x = 4; x = x + 1; // x is 5 y = x % 2; // y is 1 x++; // x is 6 x--; // x is 5 x += 3; // x is 8 var aString = "The value of x is " + x;
if (x > 0) { // do something } else { // do something else }
var myString = "I have " + (x == 1 ? x + "thing" : x + "things");
for (var i = 0; i < myArray.length; i++) { console.log(myArray[i]); } while (x < 10) { console.log(x++); }
function myIncrementFunction (x) { return x + 1; }
myIncrementFunction(1000);
var myLib = require("some-other-lib");
├── client │ ├── css │ ├── js │ │ ├── controllers │ │ └── services │ ├── libs │ └── views ├── config ├── node_modules └── server └── models
npm init
Sponsors: BrydenStokes
Ariel
Kelsie