This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Person(name, surname, yearOfBirth){ | |
this.name = name; | |
this.surname = surname; | |
this.yearOfBirth = yearOfBirth; | |
} | |
Person.prototype.sayHello = function(){ | |
console.log("Hello! My name is " + this.name + " " + this.surname); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ name: 'Mario', surname: 'Rossi', yearOfBirth: 1980 } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Person(name, surname, yearOfBirth){ | |
this.name = name; | |
this.surname = surname; | |
this.yearOfBirth = yearOfBirth; | |
} | |
var mario = new Person("Mario", "Rossi", 1980); | |
console.log(mario); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mario = new Object(); | |
mario.name = "Mario"; | |
mario.surname = "Rossi"; | |
mario.yearOfBirth = 1980; | |
console.log(mario); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[core] | |
repositoryformatversion = 0 | |
filemode = true | |
bare = false | |
logallrefupdates = true | |
[remote "origin"] | |
fetch = +refs/heads/*:refs/remotes/origin/* | |
url = https://miousername:miapassword@github.com/asiletto/js.class.git | |
[branch "master"] | |
remote = origin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ git clone https://github.com/asiletto/js.class.git | |
Initialized empty Git repository in /root/temp/js.class/.git/ | |
remote: Counting objects: 433, done. | |
remote: Compressing objects: 100% (312/312), done. | |
remote: Total 433 (delta 133), reused 404 (delta 107) | |
Receiving objects: 100% (433/433), 425.42 KiB | 598 KiB/s, done. | |
Resolving deltas: 100% (133/133), done. | |
$ ls | |
js.class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ git add * | |
$ git commit | |
[master 5b028a5] page structure | |
4 files changed, 65 insertions(+), 22 deletions(-) | |
$ git push origin master | |
Counting objects: 20, done. | |
Compressing objects: 100% (11/11), done. | |
Writing objects: 100% (11/11), 2.37 KiB, done. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "node-test", | |
"version": "0.0.1", | |
"description": "node.js examples", | |
"main": "index.js", | |
"dependencies": { | |
"router": "~0.6.2" | |
}, | |
"devDependencies": {}, | |
"scripts": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ npm init | |
name: (node) node-test | |
version: (0.0.0) 0.0.1 | |
description: node.js examples | |
entry point: (server-mod.js) index.js | |
test command: | |
git repository: | |
keywords: | |
author: Alessandro Siletto | |
license: (BSD) GNU GENERAL PUBLIC LICENSE V2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ node hello-router2.js | |
server started | |
... | |
$ wget -nv -O - http://localhost:8080/hello/Pippo | |
hello Pippo! | |
$ wget -nv -O - http://localhost:8080/goodbye/Pluto | |
goodbye Pluto! |