Slide 1

Slide 1 text

LeoNguyen.com

Slide 2

Slide 2 text

Outline - Node.js References (leonguyen.com/nodejs/references.html) - Express.js References (leonguyen.com/nodejs/expressjs/references/) - Node.js Sites (leonguyen.com/nodejs/Sites.html) - Lab 01: Node.js - Lab 02: Express.js

Slide 3

Slide 3 text

Lab 01 Node.js

Slide 4

Slide 4 text

Outline - Lab 01: Introduction to Node.js

Slide 5

Slide 5 text

Outline - Install Node.js on Windows - Install Node.js on Linux - Write a Hello Console - Write a Hello HTTP - Write a Hello TCP - Write a Hello UDP

Slide 6

Slide 6 text

Overview

Slide 7

Slide 7 text

Overview (cont)

Slide 8

Slide 8 text

Overview (cont)

Slide 9

Slide 9 text

Overview (cont)

Slide 10

Slide 10 text

Exercise 1 Install Node.js

Slide 11

Slide 11 text

Task 1 - On Windows - Goto Node.js download site nodejs.org/download (See: youtu. be/n9cs8Bmb6KU) - Check version: using command node -v (See: youtu.be/-hZ9-qkxxOc)

Slide 12

Slide 12 text

Task 1 - On Linux - Install on Ubuntu (See: youtu.be/8widdkdSo58) - Install on CentOS (See: youtu.be/bPObquO4FCM) - Check version: using command node -v (See: youtu.be/-hZ9-qkxxOc)

Slide 13

Slide 13 text

Exercise 2 Write a Hello Console

Slide 14

Slide 14 text

Task 1 - Write a hello-console.js - Enter code: https://gist.github.com/leonguyen/6472852

Slide 15

Slide 15 text

Task 2 - Run - Using command: node hello-console.js (See: youtu.be/LxGlcdR53To)

Slide 16

Slide 16 text

Exercise 3 Write a Hello HTTP

Slide 17

Slide 17 text

Task 1 - Write a hello-http.js - Enter code: https://gist.github.com/leonguyen/6492146

Slide 18

Slide 18 text

Task 2 - Run - Using command: node hello-http.js (See: youtu.be/IpafeSP6_dg)

Slide 19

Slide 19 text

Task 3 - Run - Go to: http://localhost:8000/

Slide 20

Slide 20 text

Exercise 4 Write a Hello TCP

Slide 21

Slide 21 text

Task 1 - Write a hello-tcp.js - Enter code: https://gist.github.com/leonguyen/6492200

Slide 22

Slide 22 text

Task 2 - Run - Using command: node hello-tcp.js (See: youtu.be/5_dVVRmcjWg)

Slide 23

Slide 23 text

Exercise 5 Write a Hello UDP

Slide 24

Slide 24 text

Task 1 - Write a hello-udp.js - Enter code: https://gist.github.com/leonguyen/6492554

Slide 25

Slide 25 text

Task 2 - Write a client-hello-udp.js - Enter code: https://gist.github.com/leonguyen/6492588

Slide 26

Slide 26 text

Task 3 - Run UDP - Using command: node hello-udp.js (See: youtu.be/3SzAxXu2zDI)

Slide 27

Slide 27 text

Task 4 - Run UDP Client - Using command: node client-hello-udp.js (See: youtu. be/syyp0TWQd4U)

Slide 28

Slide 28 text

Lab 02 Express.js

Slide 29

Slide 29 text

Outline - Install and config Express.js - Generate an application - MySQL

Slide 30

Slide 30 text

Exercise 1 Install and config Express.js

Slide 31

Slide 31 text

Task 1 - Create package.json - Check NPM: using command npm -v (See: youtu.be/_x3EzBCBd_o) - Enter code: https://gist.github.com/leonguyen/6504935

Slide 32

Slide 32 text

Task 2 - Install Express.js - Install Express: using command npm install (See: youtu. be/umjcT1sH22Q) or npm install -g express (for available from anywhere) - Check Express: using command express --version (See: youtu. be/a8H41rePUJM)

Slide 33

Slide 33 text

Exercise 2 Generate an application

Slide 34

Slide 34 text

Task 1 - Generate an application - Using command express --sessions --css stylus --ejs [nodeapp] (See: youtu.be/7QMhdISI-7s)

Slide 35

Slide 35 text

Task 2 - Install dependencies - Using command npm install (See: youtu.be/qgi16SrXcTI)

Slide 36

Slide 36 text

Task 3 - Run - Using command node app (See: youtu.be/xFBKkD4xC5w)

Slide 37

Slide 37 text

Task 4 - Run - Go to: http://localhost:3000 and http://localhost:3000/users

Slide 38

Slide 38 text

Exercise 3 MySQL

Slide 39

Slide 39 text

Task 1 - Install MySQL - Using command npm install mysql See: youtu.be/uEWKuQQiPVs, youtu.be/CB80P8_i7gg (CentOS)