-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
318 lines (301 loc) · 13 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
<!doctype html>
<html>
<head>
<title>
node.js
</title>
<meta http-equiv="content-type" content="text/html"; charset="utf-8">
<link href="css/impress.css" rel="stylesheet" />
<link rel="shortcut icon" href="assets/favicon.ico" />
<link href="css/prettify.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="js/prettify.js"></script>
</head>
<body onload="prettyPrint()">
<div id="impress">
<div id="first" class="step center" data-x="0" data-y="1000" data-scale="0.6" data-rotate-z="90">
<img src="assets/logo.svg" width="690" height="288" >
</div>
<div class="step" data-x="-400" data-y="1000">
Take a look of advantages
</div>
<!-- JavaScript pros section-->
<div id="js" class="step big" data-x="-400" data-y="-700" data-scale="0.5">
JavaScript
</div>
<div class="step center" data-x="-900" data-y="-700" data-z="-600" data-scale="0.4">
Using JavaScript on a web server<br> as well as the browser
</div>
<div class="step hide" data-x="-500" data-y="-700" data-z="-600" data-scale="0.4">
<img src="assets/JSeverywhere.jpg">
</div>
<div class="step center" data-x="100" data-y="-700" data-z="-600" data-scale="0.4" >
No data validation between<br> server and client
</div>
<div class="step hide" data-x="500" data-y="-700" data-z="-600" data-scale="0.4">
<img src="assets/json.png">
</div>
<div class="step center" data-x="-400" data-y="-500" data-z="-600" data-scale="0.4">
People already know it
</div>
<div class="step hide center" data-x="-400" data-y="-200" data-z="-600" data-scale="0.4">
<img src="assets/what.png">
</div>
<div class="step big" data-x="-400" data-y="-700" data-scale="0.5">
JavaScript
</div>
<!-- Event-driven pros section-->
<div id="eventd" class="step big" data-x="1600" data-y="-700" data-scale="0.5" data-rotate-z="90" data-rotate-x="90">
Event-driven development
</div>
<div class="step center hide" data-x="1600" data-y="-700" data-scale="0.5" data-rotate-z="90">
Node.js uses an <strong>event-driven</strong>, <strong> non-blocking I/O </strong> model,
which makes it lightweight.
</div>
<div class="step center" data-x="1600" data-y="-1200" data-z="-600" data-scale="0.4" data-rotate-z="90">
Async code
</div>
<div class="step hide center" data-x="1600" data-y="-900" data-z="-600" data-scale="0.4" data-rotate-z="90">
<img src="assets/async-all.jpg">
</div>
<div class="step center" data-x="1600" data-y="-150" data-z="-600" data-scale="0.4" data-rotate-z="90">
No multithreading, deadlocks, etc.
</div>
<div class="step hide center" data-x="1600" data-y="150" data-z="-600" data-scale="0.4" data-rotate-z="90">
<img src="assets/Deadlock.jpg">
</div>
<div class="step center" data-x="1400" data-y="-700" data-z="-600" data-scale="0.4" data-rotate-z="90">
Node.js keeps a <strong>single</strong> thread <br> for your code...
</div>
<div class="step hide center" data-x="1100" data-y="-700" data-z="-600" data-scale="0.4" data-rotate-z="90">
<img src="assets/meme-concurrency.jpg">
</div>
<div class="step big" data-x="1600" data-y="-700" data-scale="0.5" data-rotate-z="90" data-rotate-x="90">
Event-driven development
</div>
<!-- Fast section -->
<div id="fast" class="step big" data-x="3600" data-y="-700" data-scale="0.5">
Extremily fast
</div>
<div class="step center" data-x="3100" data-y="-700" data-z="-600" data-scale="0.4">
V8 Google Engine
</div>
<div class="step center hide" data-x="3400" data-y="-700" data-z="-600" data-scale="0.4">
<img src="assets/v8logo.png" width="400" height="400">
</div>
<div class="step center" data-x="4100" data-y="-700" data-z="-600" data-scale="0.4">
Optimized for hight concurrent <br> environments.
</div>
<div class="step center hide" data-x="4400" data-y="-700" data-z="-600" data-scale="0.4">
<img src="assets/event-driven.jpg">
</div>
<div class="step big" data-x="3600" data-y="-700" data-scale="0.5">
Extremily fast
</div>
<!-- npm section -->
<div id="npm" class="step center big" data-x="3600" data-y="1300" data-rotate-z="90" data-scale="0.5">
npm
</div>
<div class="step center" data-x="3600" data-y="900" data-z="-600" data-rotate-z="90" data-scale="0.4">
Huge community with tons <br> of great libraries
</div>
<div class="step center hide" data-x="3600" data-y="1200" data-z="-600" data-rotate-z="90" data-scale="0.4">
<img src="assets/nice-npm.jpg">
</div>
<div class="step center hide" data-x="3600" data-y="1700" data-z="-600" data-rotate-z="90" data-scale="0.4">
<strong>Warning!</strong><br>
CONS
</div>
<div class="step hide center" data-x="3600" data-y="1700" data-z="-600" data-rotate-z="90" data-rotate-x="90" data-scale="0.4">
Five versions of everything
</div>
<div class="step center hide" data-x="3600" data-y="1700" data-z="-300" data-rotate-z="90" data-rotate-x="90" data-scale="0.4">
<img src="assets/choose.png">
</div>
<div class="step big" data-x="3600" data-y="1300" data-rotate-z="90" data-scale="0.5">
npm
</div>
<!-- Installing section -->
<div id="install" class="step big center hide " data-x="-1800" data-y="200" data-rotate-z="90" data-scale="0.5">
How to install?
</div>
<div class="step center" data-x="-1800" data-y="-400" data-z="-600" data-rotate-z="90" data-scale="0.4">
Ubuntu
</div>
<div class="step left hide" data-x="-1800" data-y="-400" data-z="-600" data-rotate-z="90" data-rotate-x="90" data-scale="0.4">
Setup with Ubuntu:
<pre><code>curl --silent --location
https://deb.nodesource.com/setup_4.x
| sudo bash -
</code></pre>
Then install
<pre><code>sudo apt-get install --yes nodejs
</code></pre>
</div>
<div class="step center" data-x="-1800" data-y="800" data-z="-600" data-rotate-z="90" data-scale="0.4">
Fedora
</div>
<div class="step left hide" data-x="-1800" data-y="800" data-z="-600" data-rotate-z="90" data-rotate-x="90" data-scale="0.4">
Official Fedora Node.js and npm packages are available in Fedora 18 and later. Install with:
<pre><code>sudo yum install nodejs npm
</code><pre>
</div>
<div class="step center" data-x="-2100" data-y="200" data-z="-600" data-rotate-z="90" data-scale="0.4">
Windows
</div>
<div class="step center hide" data-x="-2100" data-y="200" data-z="-600" data-rotate-z="90" data-rotate-x="90" data-scale="0.4">
<img src="assets/win.jpg" width="306" height="408">
</div>
<div class="step big center" data-x="-1800" data-y="200" data-rotate-z="90" data-scale="0.5">
How to install?
</div>
<!-- npm must-have modules section -->
<div id="modules" class="step big center" data-x="-2000" data-y="1700" data-scale="0.5">
npm must-have modules
</div>
<div class="step center" data-x="-2400" data-y="1700" data-z="-600" data-scale="0.4">
Asynchronous Pattern Module
</div>
<div class="step center hide" data-x="-2400" data-y="1800" data-z="-600" data-scale="0.4">
Step
</div>
<div class="step center hide" data-x="-2400" data-y="1900" data-z="-600" data-scale="0.4">
Futures
</div>
<div class="step center hide" data-x="-2400" data-y="2000" data-z="-600" data-scale="0.4">
Async
</div>
<div class="step center" data-x="-1600" data-y="1700" data-z="-600" data-scale="0.4">
Web Framework
</div>
<div class="step center hide" data-x="-1600" data-y="1800" data-z="-600" data-scale="0.4">
Express
</div>
<div class="step center hide" data-x="-1600" data-y="1900" data-z="-600" data-scale="0.4">
jQuery
</div>
<div class="step center hide" data-x="-1600" data-y="2000" data-z="-600" data-scale="0.4">
Bootstrap
</div>
<div class="step center" data-x="-2000" data-y="1900" data-z="-600" data-scale="0.4">
Testing
</div>
<div class="step center hide" data-x="-2000" data-y="2000" data-z="-600" data-scale="0.4">
JSHint
</div>
<div class="step center hide" data-x="-2000" data-y="2100" data-z="-600" data-scale="0.4">
Mocha
</div>
<div class="step center hide" data-x="-2000" data-y="2200" data-z="-600" data-scale="0.4">
Vows
</div>
<div class="step big center" data-x="-2000" data-y="1700" data-scale="0.5">
npm must-have modules
</div>
<div class="step center hide" data-x="-2000" data-y="1700" data-rotate-x="90" data-scale="0.5">
Install package global
<pre><code>npm install http-server -g
</code></pre>
Install package local
<pre><code>npm install http-server
</code></pre>
</div>
<!-- Examples section-->
<div id="examples" class="step big center" data-x="-3300" data-y="200" data-rotate-z="90" data-scale="0.5">
Examples
</div>
<div class="step center" data-x="-3200" data-y="-200" data-z="-600" data-rotate-z="90" data-scale="0.4">
Command promt <br> echo
</div>
<div class="step left hide" data-x="-3200" data-y="-200" data-z="-600" data-rotate-z="90" data-rotate-x="90" data-scale="0.4">
<pre class="prettyprint linenums"><code id="codesize">for(i = 2; i < process.argv.length; i++){
process.stdout.write(process.argv[i]);
process.stdout.write(" ");
}
process.stdout.write('\n');</code></pre>
</div>
<div class="step center" data-x="-3400" data-y="-200" data-z="-600" data-rotate-z="90" data-scale="0.4">
Asynchronous
</div>
<div class="step left wide hide" data-x="-3400" data-y="-200" data-z="-600" data-rotate-z="90" data-rotate-x="90" data-scale="0.4">
<pre class="prettyprint linenums"><code id="codesize">var results = [];
setTimeout(function() {
console.log("Task 1");
results[0] = 1;
setTimeout(function() {
console.log("Task 2");
results[1] = 2;
setTimeout(function() {
console.log("Task 3");
results[2] = 3;
}, 10000);
}, 800);
}, 100);</code></pre>
</div>
<div class="step center hide" data-x="-3800" data-y="-200" data-z="-600" data-rotate-z="90" data-scale="0.4">
<img src="assets/xzibit.jpg">
</div>
<div class="step center" data-x="-3400" data-y="600" data-z="-600" data-rotate-z="90" data-scale="0.4">
HTTP Server
</div>
<div class="step left wide hide" data-x="-3400" data-y="600" data-z="-600" data-rotate-z="90" data-rotate-x="90" data-scale="0.4">
<pre class="prettyprint linenums"><code id="codesize">// Include http module.
var http = require("http");
// Create the server.
http.createServer(function(request, response) {
// Write headers to the response.
response.writeHead(200, {"Content-Type": "text/plain"});
response.write("Hello World from server");
//End of response
response.end();
}).listen(8888);
</code></pre>
</div>
<div class="step center" data-x="-3200" data-y="600" data-z="-600" data-rotate-z="90" data-scale="0.4">
File I/O
</div>
<div class="step left wide hide" data-x="-3200" data-y="600" data-z="-600" data-rotate-z="90" data-rotate-x="90" data-scale="0.4">
<pre class="prettyprint linenums" id="codesize"><code>var http = require("http"),
// And file system module
fs = require("fs");
http.createServer(function (request, response) {
// Check if user requests /
if (request.url == '/') {
// Read the file.
fs.readFile('test.txt', 'utf-8', function (error, data) {
// Write headers.
response.writeHead(200, {
'Content-Type': 'text/plain'
});
// Increment the number obtained from file.
data = parseInt(data) + 1;
// Write incremented number to file.
fs.writeFile('test.txt', data);
// End response with some nice message.
response.end('This page was refreshed ' + data +
' times!');
});
} else {
// Indicate that requested file was not found.
response.writeHead(404);
// And end request without sending any data.
response.end();
}
}).listen(8888);
</code></pre>
</div>
<div class="step big center" data-x="-3300" data-y="200" data-rotate-z="90" data-scale="0.5">
Examples
</div>
<div class="step big center" data-x="-4000" data-y="200" data-rotate-z="90" data-scale="0.5">
Questions?
</div>
<!-- Overview slide -->
<div id="overview" class="step" data-x="0" data-y="0" data-scale="5">
Overview
</div>
</div>
<script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"></script>
<script type="text/javascript" src="js/impress.js"> </script>
<script>impress().init();</script>
</body>
</html>