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/
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
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);
});
MySQL | MongoDB |
---|---|
Table | Collection |
Row | Document |
Column | Field |
Joins | Embedded documents, linking |
{
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 }
)
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