closure เพื่อ implement module pattern
ใช้ใน course นี้ code editor , HTTP server , API key for openweathermap.com
editor นอกจาก VSC – extension ใช้ open in browser เพื่อใช้ alt+b switch , ยังมี atom , sublimetext
– http server ใช้ใน node , npm $ npm install http-server -g
– ถ้ามีปัญหาตอน install ให้ใช้ sudo npm install http-server -g
เปิดใช้ $ http-server จะเข้าไปอยู่ใน current directory , และ ^c เพื่อ back to dashboard
ใช้ data จาก https://openweathermap.org , sign up และได้รับ API free แต่ละ API key จะใช้กับแต่ละ account

http server

w- http-server: a simple static HTTP server
ใช้ testing , local develop , learning
– ใช้ npx กรณีที่ run อย่างเดียว แต่ไม่ได้ install – กรณีที่ ต้องการแค่ test version นั้น แต่ใช้จริง อาจจะใช้หลัง version นั้น จึงไม่ได้ install

sudo

w- Don’t use `sudo` with `npm`
เพราะ Package นั้น อาจจะ masquerading ปลอมตัวเข้ามา และถ้ายิ่ง run ใน root อาจจะทำให้พังได้
และจริงๆเราสามารถแก้ไขDNS ได้อยู่แล้ว
และถ้าเราทำแบบ sudo npm install โดยไม่มี -g มันจะสร้าง local directory , และถ้าเกิดอนาคต เรา npm install อะไรใน direction นี้ ก็อาจจะทำให้พังได้

npm install -g

official –An introduction to the npm package manager
repository นอกจาก npm , github แล้วมีที่อื่นหรือไม่

1. Building Blocks of Closures

Local and Global scope