2. 1. NODE.JS
Download & Install Node.js at nodejs.org.
Now what? Just do type code and run! (next page)
3. 2. JUST FOLLOW THIS – HELLO WORLD
1. Make .js file (Just type with notepad and store this with
different name that .js)
Make it sure that file name can’t be node.js!!(error)
2. Next just type following next paragraphs.
3. How to run? With node.js command prompt!
You need file location information to run.
4. 2. JUST FOLLOW THIS – HELLO WORLD
Check .js location and approach to this location in
node.js command prompt.
Now Server is running!!
Check it with connecting http://localhost:8000/
5. 2. JUST FOLLOW THIS – HELLO WORLD
Fantastic result, very simple and easy!!
Now you can do anything with Googling!!
Google is my second brain… (actually first…)
From next slide, introduce my project using node.js
6. 3. LOG SEARCH PROJECT
Whole code : www.github.com/kwakjaehoon
First, look into auto.sh file.
In this file, commands are listed. You need to install
npms, and if you need save those with --save
What is npm??
- npm makes it easy for JavaScript developers to sh
are and reuse code, and it makes it easy to update th
e code that you're sharing.
7. 3. LOG SEARCH PROJECT
With my code you can get a insight to node.js if you
just follow my code from 1 line to end line.
If you have any question in it, just google it!!
8. 4. WEATHER FORECAST PROJECT
Source code at
https://github.com/xptr33/CAPSTONE_PRJ2_FORECAST
How we implemented this project using nodejs?
In this project, node.js functions in three ways:
Node.js works as a web server using ‘express’
module.
Node.js retrieves necessary weather forecast data
from kma.go.kr using ‘request’ module.
Node.js pushes/pulls weather data onto/from
database using ‘mysql’ module.
9. 4. WEATHER FORECAST PROJECT
Web browser
(client)
Web server
(server on node.js)
MYSQL Database
kma.go.kr
(weather service)
Sends weather
data to clients
(1) Pushes
weather data onto
database
Retrieves weather data
periodically (approx. 1 hour)
Conceptual View
(2) Pulls weather data from
database when there is any
request from clients
10. 4. WEATHER FORECAST PROJECT
Web browser
(client)
– chart.html
Web server
(server on node.js)
MYSQL Database
kma.go.kr
(weather service)
server.js – express
module
collect.js – request, xml
module (xml module
required to parse xml-format
weather data.)
Technical View
db.js / insert.js – mysql module