Toggle navigation
Toggle navigation
This project
Loading...
Sign in
신정아
/
weather_chatbot
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Issues
1
Network
Create a new issue
Commits
Issue Boards
Authored by
Ubuntu
2020-06-24 14:46:35 +0000
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
31e21159f7b8246af6a3f3bf2e78cc4ce46fbbc4
31e21159
1 parent
a743328e
0624
Show whitespace changes
Inline
Side-by-side
Showing
43 changed files
with
70 additions
and
530 deletions
Experiments/express/assignments/assignment01/app.js
Experiments/express/assignments/assignment01/package.json
Experiments/express/assignments/assignment02/app.js
Experiments/express/assignments/assignment02/package.json
Experiments/express/tutorials/approute/app.js
Experiments/express/tutorials/approute/package.json
Experiments/express/tutorials/expressrouter/app.js
Experiments/express/tutorials/expressrouter/birds.js
Experiments/express/tutorials/expressrouter/package.json
Experiments/express/tutorials/helloworld/app.js
Experiments/express/tutorials/helloworld/package.json
Experiments/express/tutorials/multiplehandler/app.js
Experiments/express/tutorials/multiplehandler/package.json
Experiments/express/tutorials/render/app.js
Experiments/express/tutorials/render/package.json
Experiments/express/tutorials/render/views/index.ejs
Experiments/express/tutorials/routeparameter/app.js
Experiments/express/tutorials/routeparameter/package.json
Experiments/express/tutorials/routingpath/app.js
Experiments/express/tutorials/routingpath/package.json
Experiments/express/tutorials/session/app.js
Experiments/express/tutorials/session/package.json
Experiments/express/tutorials/simplerouting/app.js
Experiments/express/tutorials/simplerouting/package.json
Experiments/express/tutorials/specialrouting/app.js
Experiments/express/tutorials/specialrouting/package.json
Experiments/express/tutorials/staticfiles/app.js
Experiments/express/tutorials/staticfiles/package.json
Experiments/express/tutorials/staticfiles/public/icon.png
Experiments/express/tutorials/staticfiles/public/index.html
Experiments/messenger/notify/app.js
Experiments/messenger/push/app.js
Experiments/messenger/push/package-lock.json
Experiments/messenger/push/package.json
Experiments/messenger/reply/app.js
Experiments/messenger/ssl/app.js
Experiments/messenger/webhook/app.js
Experiments/nodejs/Assignments/app.js
Experiments/nodejs/Assignments/mymodule.js
Experiments/nodejs/Tutorial/event01/app.js
Experiments/nodejs/Tutorial/event02/app.js
Experiments/nodejs/Tutorial/mymodule/app.js
Experiments/nodejs/Tutorial/mymodule/mymodule.js
Experiments/express/assignments/assignment01/app.js
deleted
100644 → 0
View file @
a743328
var
express
=
require
(
'express'
);
var
app
=
express
();
var
bodyParser
=
require
(
'body-parser'
);
app
.
use
(
bodyParser
.
urlencoded
({
extended
:
false
}));
app
.
use
(
bodyParser
.
json
());
var
books
=
new
Array
();
app
.
get
(
'/books/:bookId'
,
function
(
req
,
res
)
{
var
bookId
=
req
.
params
.
bookId
;
console
.
log
(
books
[
bookId
]);
res
.
send
(
books
[
bookId
]);
});
/*
* json representation of book object
{
"id" : 2,
"name" : "book2",
"price" : 2000,
"author" : "jin"
}
*/
app
.
post
(
'/books'
,
function
(
req
,
res
)
{
// Create book information
books
[
req
.
body
.
id
]
=
[
req
.
body
.
id
,
req
.
body
.
name
,
req
.
body
.
price
,
req
.
body
.
author
];
res
.
send
(
books
[
req
.
body
.
id
]);
})
app
.
put
(
'/books'
,
function
(
req
,
res
)
{
// Update book information
})
app
.
delete
(
'/books/:bookId'
,
function
(
req
,
res
)
{
// Delete book information
})
var
server
=
app
.
listen
(
80
);
console
.
log
(
books
);
Experiments/express/assignments/assignment01/package.json
deleted
100644 → 0
View file @
a743328
{
"name"
:
"assignment01"
,
"version"
:
"1.0.0"
,
"description"
:
""
,
"main"
:
"index.js"
,
"scripts"
:
{
"test"
:
"echo
\"
Error: no test specified
\"
&& exit 1"
},
"author"
:
""
,
"license"
:
"ISC"
,
"dependencies"
:
{
"body-parser"
:
"^1.17.1"
,
"express"
:
"^4.15.2"
}
}
Experiments/express/assignments/assignment02/app.js
deleted
100644 → 0
View file @
a743328
var
express
=
require
(
'express'
);
var
app
=
express
();
var
bodyParser
=
require
(
'body-parser'
);
var
session
=
require
(
'express-session'
)
app
.
use
(
session
({
secret
:
'keyboard cat'
,
cookie
:
{
maxAge
:
60000
}}))
app
.
use
(
bodyParser
.
urlencoded
({
extended
:
false
}));
app
.
use
(
bodyParser
.
json
());
var
users
=
new
Array
();
users
[
0
]
=
{
"userId"
:
0
,
"name"
:
"jin"
,
"password"
:
"abc"
,
"isAdmin"
:
true
}
app
.
put
(
'/login'
,
function
(
req
,
res
)
{
// users 배열에서 찾도록 처리 해야 함
// admin 여부를 확인하여 체크
// req.body.id : ID
// req.body.name : 패스워드
res
.
send
(
"Login"
);
});
app
.
put
(
'/logout'
,
function
(
req
,
res
)
{
// Logout
// 세션 유효 여부를 체크하고 세션 Delete
req
.
session
.
userId
=
null
;
res
.
send
(
"LogOut"
);
});
var
auth
=
function
(
req
,
res
,
next
)
{
// Session Check
// 어드민 여부 체크 필요
if
(
req
.
session
.
userId
!=
null
)
next
();
else
res
.
send
(
"Error"
);
};
app
.
get
(
'/user/:userId'
,
auth
,
function
(
req
,
res
)
{
// get User Information
res
.
send
(
"OK"
);
});
// 사용자 추가 시에 admin 여부도 추가해야 함
var
server
=
app
.
listen
(
80
);
Experiments/express/assignments/assignment02/package.json
deleted
100644 → 0
View file @
a743328
{
"name"
:
"assignment02"
,
"version"
:
"1.0.0"
,
"description"
:
""
,
"main"
:
"index.js"
,
"scripts"
:
{
"test"
:
"echo
\"
Error: no test specified
\"
&& exit 1"
},
"author"
:
""
,
"license"
:
"ISC"
,
"dependencies"
:
{
"body-parser"
:
"^1.17.1"
,
"express"
:
"^4.15.2"
,
"express-session"
:
"^1.15.2"
}
}
Experiments/express/tutorials/approute/app.js
deleted
100644 → 0
View file @
a743328
var
express
=
require
(
'express'
);
var
app
=
express
();
app
.
get
(
'/'
,
function
(
req
,
res
)
{
res
.
send
(
'hello world'
);
})
app
.
route
(
'/book'
)
.
get
(
function
(
req
,
res
)
{
res
.
send
(
'Get a random book'
);
})
.
post
(
function
(
req
,
res
)
{
res
.
send
(
'Add a book'
);
})
.
put
(
function
(
req
,
res
)
{
res
.
send
(
'Update the book'
);
});
var
server
=
app
.
listen
(
23023
);
Experiments/express/tutorials/approute/package.json
deleted
100644 → 0
View file @
a743328
{
"name"
:
"approute"
,
"version"
:
"1.0.0"
,
"description"
:
""
,
"main"
:
"index.js"
,
"scripts"
:
{
"test"
:
"echo
\"
Error: no test specified
\"
&& exit 1"
},
"author"
:
""
,
"license"
:
"ISC"
,
"dependencies"
:
{
"express"
:
"^4.15.2"
}
}
Experiments/express/tutorials/expressrouter/app.js
deleted
100644 → 0
View file @
a743328
var
express
=
require
(
'express'
);
var
app
=
express
();
var
birds
=
require
(
'./birds'
);
app
.
get
(
'/'
,
function
(
req
,
res
)
{
res
.
send
(
'hello world'
);
})
app
.
use
(
'/birds'
,
birds
);
var
server
=
app
.
listen
(
23023
);
Experiments/express/tutorials/expressrouter/birds.js
deleted
100644 → 0
View file @
a743328
var
express
=
require
(
'express'
);
var
router
=
express
.
Router
();
router
.
get
(
'/'
,
function
(
req
,
res
)
{
res
.
send
(
'Birds home page'
);
})
router
.
get
(
'/about'
,
function
(
req
,
res
)
{
res
.
send
(
'About birds'
);
});
module
.
exports
=
router
;
Experiments/express/tutorials/expressrouter/package.json
deleted
100644 → 0
View file @
a743328
{
"name"
:
"expressrouter"
,
"version"
:
"1.0.0"
,
"description"
:
""
,
"main"
:
"index.js"
,
"scripts"
:
{
"test"
:
"echo
\"
Error: no test specified
\"
&& exit 1"
},
"author"
:
""
,
"license"
:
"ISC"
,
"dependencies"
:
{
"express"
:
"^4.15.2"
}
}
Experiments/express/tutorials/helloworld/app.js
deleted
100644 → 0
View file @
a743328
var
express
=
require
(
'express'
);
var
app
=
express
();
app
.
get
(
'/'
,
function
(
req
,
res
)
{
res
.
send
(
'Hello World'
);
})
var
server
=
app
.
listen
(
23023
,
function
()
{
var
host
=
server
.
address
().
address
var
port
=
server
.
address
().
port
console
.
log
(
"Example app listening at http://%s:%s"
,
host
,
port
)
})
Experiments/express/tutorials/helloworld/package.json
deleted
100644 → 0
View file @
a743328
{
"name"
:
"helloworld"
,
"version"
:
"1.0.0"
,
"description"
:
""
,
"main"
:
"index.js"
,
"scripts"
:
{
"test"
:
"echo
\"
Error: no test specified
\"
&& exit 1"
},
"author"
:
""
,
"license"
:
"ISC"
,
"dependencies"
:
{
"express"
:
"^4.15.2"
}
}
Experiments/express/tutorials/multiplehandler/app.js
deleted
100644 → 0
View file @
a743328
var
express
=
require
(
'express'
);
var
app
=
express
();
app
.
get
(
'/b'
,
function
(
req
,
res
,
next
)
{
console
.
log
(
'the response will be sent by the next function ...'
)
next
()
},
function
(
req
,
res
)
{
res
.
send
(
'Hello from B!'
)
})
var
cb0
=
function
(
req
,
res
,
next
)
{
console
.
log
(
"call by cb0"
);
next
()
}
var
cb1
=
function
(
req
,
res
,
next
)
{
console
.
log
(
"call by cb1"
);
res
.
send
(
'Hello from C!'
)
}
app
.
get
(
'/c'
,
[
cb0
,
cb1
])
var
server
=
app
.
listen
(
23023
);
Experiments/express/tutorials/multiplehandler/package.json
deleted
100644 → 0
View file @
a743328
{
"name"
:
"multiplehandler"
,
"version"
:
"1.0.0"
,
"description"
:
""
,
"main"
:
"index.js"
,
"scripts"
:
{
"test"
:
"echo
\"
Error: no test specified
\"
&& exit 1"
},
"author"
:
""
,
"license"
:
"ISC"
,
"dependencies"
:
{
"express"
:
"^4.15.2"
}
}
Experiments/express/tutorials/render/app.js
deleted
100644 → 0
View file @
a743328
var
express
=
require
(
'express'
);
var
app
=
express
();
app
.
set
(
'view engine'
,
'ejs'
);
app
.
set
(
'views'
,
'views'
);
app
.
get
(
'/'
,
function
(
req
,
res
)
{
res
.
render
(
'index'
,
{
title
:
'OSS Page'
});
});
var
server
=
app
.
listen
(
23023
);
Experiments/express/tutorials/render/package.json
deleted
100644 → 0
View file @
a743328
{
"name"
:
"render"
,
"version"
:
"1.0.0"
,
"description"
:
""
,
"main"
:
"index.js"
,
"scripts"
:
{
"test"
:
"echo
\"
Error: no test specified
\"
&& exit 1"
},
"author"
:
""
,
"license"
:
"ISC"
,
"dependencies"
:
{
"ejs"
:
"^2.5.6"
,
"express"
:
"^4.15.2"
}
}
Experiments/express/tutorials/render/views/index.ejs
deleted
100644 → 0
View file @
a743328
html>
<body>
<%= title %>
</body>
</html>
Experiments/express/tutorials/routeparameter/app.js
deleted
100644 → 0
View file @
a743328
var
express
=
require
(
'express'
);
var
app
=
express
();
app
.
get
(
'/users/:userId/books/:bookId'
,
function
(
req
,
res
)
{
res
.
send
(
req
.
params
);
})
var
server
=
app
.
listen
(
23023
);
Experiments/express/tutorials/routeparameter/package.json
deleted
100644 → 0
View file @
a743328
{
"name"
:
"routeparameter"
,
"version"
:
"1.0.0"
,
"description"
:
""
,
"main"
:
"index.js"
,
"scripts"
:
{
"test"
:
"echo
\"
Error: no test specified
\"
&& exit 1"
},
"author"
:
""
,
"license"
:
"ISC"
,
"dependencies"
:
{
"express"
:
"^4.15.2"
}
}
Experiments/express/tutorials/routingpath/app.js
deleted
100644 → 0
View file @
a743328
var
express
=
require
(
'express'
);
var
app
=
express
();
// The routing path matches requests to /about
app
.
get
(
'/about'
,
function
(
req
,
res
)
{
res
.
send
(
'about'
)
})
// The routing path matches requests to /random.text
app
.
get
(
'/random.text'
,
function
(
req
,
res
)
{
res
.
send
(
'random.text'
)
})
// This route path matches abcd, abxcd, abRANDOMcd, ab123cd, and so on.
app
.
get
(
'/ab*cd'
,
function
(
req
,
res
)
{
res
.
send
(
'ab*cd'
)
})
var
server
=
app
.
listen
(
23023
);
Experiments/express/tutorials/routingpath/package.json
deleted
100644 → 0
View file @
a743328
{
"name"
:
"routingpath"
,
"version"
:
"1.0.0"
,
"description"
:
""
,
"main"
:
"index.js"
,
"scripts"
:
{
"test"
:
"echo
\"
Error: no test specified
\"
&& exit 1"
},
"author"
:
""
,
"license"
:
"ISC"
,
"dependencies"
:
{
"express"
:
"^4.15.2"
}
}
Experiments/express/tutorials/session/app.js
deleted
100644 → 0
View file @
a743328
var
express
=
require
(
'express'
);
var
app
=
express
();
var
session
=
require
(
'express-session'
)
app
.
use
(
session
({
secret
:
'keyboard cat'
,
cookie
:
{
maxAge
:
60000
}}))
app
.
get
(
'/'
,
function
(
req
,
res
,
next
)
{
var
sess
=
req
.
session
;
console
.
log
(
req
.
session
);
if
(
sess
.
views
)
{
sess
.
views
++
;
res
.
send
(
"session Views "
+
sess
.
views
);
res
.
send
();
}
else
{
req
.
session
.
views
=
1
;
res
.
send
(
"welcome to the session demo. refresh!"
);
res
.
end
();
}
});
var
server
=
app
.
listen
(
23023
);
Experiments/express/tutorials/session/package.json
deleted
100644 → 0
View file @
a743328
{
"name"
:
"session"
,
"version"
:
"1.0.0"
,
"description"
:
""
,
"main"
:
"index.js"
,
"scripts"
:
{
"test"
:
"echo
\"
Error: no test specified
\"
&& exit 1"
},
"author"
:
""
,
"license"
:
"ISC"
,
"dependencies"
:
{
"express"
:
"^4.15.2"
,
"express-session"
:
"^1.15.2"
}
}
Experiments/express/tutorials/simplerouting/app.js
deleted
100644 → 0
View file @
a743328
var
express
=
require
(
'express'
);
var
app
=
express
();
app
.
get
(
'/'
,
function
(
req
,
res
)
{
res
.
send
(
'hello world'
);
})
var
server
=
app
.
listen
(
23023
);
Experiments/express/tutorials/simplerouting/package.json
deleted
100644 → 0
View file @
a743328
{
"name"
:
"simplerouting"
,
"version"
:
"1.0.0"
,
"description"
:
""
,
"main"
:
"index.js"
,
"scripts"
:
{
"test"
:
"echo
\"
Error: no test specified
\"
&& exit 1"
},
"author"
:
""
,
"license"
:
"ISC"
,
"dependencies"
:
{
"express"
:
"^4.15.2"
}
}
Experiments/express/tutorials/specialrouting/app.js
deleted
100644 → 0
View file @
a743328
var
express
=
require
(
'express'
);
var
app
=
express
();
app
.
all
(
'/'
,
function
(
req
,
res
,
next
)
{
console
.
log
(
'Accessing the secret section ...'
)
next
()
// pass control to the next handler
})
app
.
get
(
'/'
,
function
(
req
,
res
)
{
res
.
send
(
'hello world'
);
})
app
.
post
(
'/'
,
function
(
req
,
res
)
{
res
.
send
(
'POST request to the homepage'
)
})
var
server
=
app
.
listen
(
23023
);
Experiments/express/tutorials/specialrouting/package.json
deleted
100644 → 0
View file @
a743328
{
"name"
:
"specialrouting"
,
"version"
:
"1.0.0"
,
"description"
:
""
,
"main"
:
"index.js"
,
"scripts"
:
{
"test"
:
"echo
\"
Error: no test specified
\"
&& exit 1"
},
"author"
:
""
,
"license"
:
"ISC"
,
"dependencies"
:
{
"express"
:
"^4.15.2"
}
}
Experiments/express/tutorials/staticfiles/app.js
deleted
100644 → 0
View file @
a743328
var
express
=
require
(
'express'
);
var
app
=
express
();
app
.
use
(
express
.
static
(
'public'
));
app
.
get
(
'/'
,
function
(
req
,
res
)
{
res
.
send
(
'Hello World'
);
})
var
server
=
app
.
listen
(
23023
);
Experiments/express/tutorials/staticfiles/package.json
deleted
100644 → 0
View file @
a743328
{
"name"
:
"staticfiles"
,
"version"
:
"1.0.0"
,
"description"
:
""
,
"main"
:
"index.js"
,
"scripts"
:
{
"test"
:
"echo
\"
Error: no test specified
\"
&& exit 1"
},
"author"
:
""
,
"license"
:
"ISC"
,
"dependencies"
:
{
"express"
:
"^4.15.2"
}
}
Experiments/express/tutorials/staticfiles/public/icon.png
deleted
100644 → 0
View file @
a743328
6.72 KB
Experiments/express/tutorials/staticfiles/public/index.html
deleted
100644 → 0
View file @
a743328
<html>
<body>
Public index.html
</body>
</html>
Experiments/messenger/notify/app.js
View file @
31e2115
// 모듈을 읽어 들입니다.
const
request
=
require
(
'request'
);
const
request
=
require
(
'request'
);
//request라는 모듈로 http를 노드에서 통신할 수 있게
// 요청을 위한 상수를 선언합니다: TOKEN은 자신의 것을 입력해주세요.
const
TARGET_URL
=
'https://notify-api.line.me/api/notify'
;
const
TOKEN
=
'
///채워주세요///
'
;
const
TARGET_URL
=
'https://notify-api.line.me/api/notify'
;
//notify api의 주소
const
TOKEN
=
'
JSroU3MtclQ9bOZEL93Sn10X0NOcOQH0YenlJ7E6UHE
'
;
// 요청합니다.
request
.
post
(
{
...
...
Experiments/messenger/push/app.js
View file @
31e2115
...
...
@@ -2,8 +2,8 @@ const request = require('request');
const
TARGET_URL
=
'https://api.line.me/v2/bot/message/push'
const
MULTI_TARGET_URL
=
'https://api.line.me/v2/bot/message/multicast'
const
BROAD_TARGET_URL
=
'https://api.line.me/v2/bot/message/broadcast'
const
TOKEN
=
'
채널 토큰으로 교체
'
const
USER_ID
=
'
사용자의 ID, 메세지 수신 시에 확인할 수 있음
'
const
TOKEN
=
'
RbPAXRYWub0evg2yyi7oiHytZsZsE0JtbZgRYZNZDU1vjpJkOwGqwh+aKTYKVhVHh6LZOUVZLl84NQQlNWNbXR9hUhPEiLEK0cie4O3OlKUuEe/3wAsjPu7HbRi1zn9BsR3Qr4pcqmiIKP8HRUKvEwdB04t89/1O/w1cDnyilFU=
'
const
USER_ID
=
'
U484f0bb741ba39b93dcba8dbb731860d
'
// Single User
// request.post(
...
...
@@ -77,3 +77,4 @@ const USER_ID = '사용자의 ID, 메세지 수신 시에 확인할 수 있음'
},(
error
,
response
,
body
)
=>
{
console
.
log
(
body
)
});
\ No newline at end of file
...
...
Experiments/messenger/push/package-lock.json
View file @
31e2115
...
...
@@ -199,6 +199,11 @@
"verror"
:
"1.10.0"
}
},
"lodash"
:
{
"version"
:
"4.17.15"
,
"resolved"
:
"https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz"
,
"integrity"
:
"sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A=="
},
"mime-db"
:
{
"version"
:
"1.44.0"
,
"resolved"
:
"https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz"
,
...
...
@@ -264,6 +269,34 @@
"uuid"
:
"^3.3.2"
}
},
"request-promise-core"
:
{
"version"
:
"1.1.3"
,
"resolved"
:
"https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.3.tgz"
,
"integrity"
:
"sha512-QIs2+ArIGQVp5ZYbWD5ZLCY29D5CfWizP8eWnm8FoGD1TX61veauETVQbrV60662V0oFBkrDOuaBI8XgtuyYAQ=="
,
"requires"
:
{
"lodash"
:
"^4.17.15"
}
},
"request-promise-native"
:
{
"version"
:
"1.0.8"
,
"resolved"
:
"https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.8.tgz"
,
"integrity"
:
"sha512-dapwLGqkHtwL5AEbfenuzjTYg35Jd6KPytsC2/TLkVMz8rm+tNt72MGUWT1RP/aYawMpN6HqbNGBQaRcBtjQMQ=="
,
"requires"
:
{
"request-promise-core"
:
"1.1.3"
,
"stealthy-require"
:
"^1.1.1"
,
"tough-cookie"
:
"^2.3.3"
}
},
"rquest"
:
{
"version"
:
"0.1.0"
,
"resolved"
:
"https://registry.npmjs.org/rquest/-/rquest-0.1.0.tgz"
,
"integrity"
:
"sha512-gIG0JFuiAKvcKLl1H93JO/pliB/eUHTRRoJ+AyGEcEh8ub68WsV7gc87HVUX6q+6bU8ErYdDESS6NHeSMba5LQ=="
,
"requires"
:
{
"request"
:
"^2.85.0"
,
"request-promise-native"
:
"^1.0.5"
,
"seventh"
:
"^0.7.3"
}
},
"safe-buffer"
:
{
"version"
:
"5.2.1"
,
"resolved"
:
"https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz"
,
...
...
@@ -274,6 +307,19 @@
"resolved"
:
"https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz"
,
"integrity"
:
"sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
},
"setimmediate"
:
{
"version"
:
"1.0.5"
,
"resolved"
:
"https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz"
,
"integrity"
:
"sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU="
},
"seventh"
:
{
"version"
:
"0.7.35"
,
"resolved"
:
"https://registry.npmjs.org/seventh/-/seventh-0.7.35.tgz"
,
"integrity"
:
"sha512-8uGsybZk/XBSv7BvyjbSeK+R8vpWh2jkZJq0UIMVlJTr9CZsCLTfGWKtcBxmHzMUbzSPxa134prhvZA8GuIx/w=="
,
"requires"
:
{
"setimmediate"
:
"^1.0.5"
}
},
"sshpk"
:
{
"version"
:
"1.16.1"
,
"resolved"
:
"https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz"
,
...
...
@@ -290,6 +336,11 @@
"tweetnacl"
:
"~0.14.0"
}
},
"stealthy-require"
:
{
"version"
:
"1.1.1"
,
"resolved"
:
"https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz"
,
"integrity"
:
"sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks="
},
"tough-cookie"
:
{
"version"
:
"2.5.0"
,
"resolved"
:
"https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz"
,
...
...
Experiments/messenger/push/package.json
View file @
31e2115
...
...
@@ -9,6 +9,7 @@
"author"
:
""
,
"license"
:
"ISC"
,
"dependencies"
:
{
"request"
:
"^2.88.2"
"request"
:
"^2.88.2"
,
"rquest"
:
"^0.1.0"
}
}
...
...
Experiments/messenger/reply/app.js
View file @
31e2115
var
express
=
require
(
'express'
);
const
request
=
require
(
'request'
);
const
TARGET_URL
=
'https://api.line.me/v2/bot/message/reply'
const
TOKEN
=
'
채널 토큰으로 변경
'
const
TOKEN
=
'
RbPAXRYWub0evg2yyi7oiHytZsZsE0JtbZgRYZNZDU1vjpJkOwGqwh+aKTYKVhVHh6LZOUVZLl84NQQlNWNbXR9hUhPEiLEK0cie4O3OlKUuEe/3wAsjPu7HbRi1zn9BsR3Qr4pcqmiIKP8HRUKvEwdB04t89/1O/w1cDnyilFU=
'
const
fs
=
require
(
'fs'
);
const
path
=
require
(
'path'
);
const
HTTPS
=
require
(
'https'
);
const
domain
=
"
도메인 변경
"
const
domain
=
"
www.osschat.tk
"
const
sslport
=
23023
;
const
bodyParser
=
require
(
'body-parser'
);
var
app
=
express
();
app
.
use
(
bodyParser
.
json
());
app
.
post
(
'/hook'
,
function
(
req
,
res
)
{
app
.
post
(
'/hook'
,
function
(
req
,
res
)
{
//hootk으로 사용자가 보낸 메세지가 들어옴
var
eventObj
=
req
.
body
.
events
[
0
];
var
source
=
eventObj
.
source
;
var
message
=
eventObj
.
message
;
// request log
// request log
//
console
.
log
(
'======================'
,
new
Date
()
,
'======================'
);
console
.
log
(
'[request]'
,
req
.
body
);
console
.
log
(
'[request source] '
,
eventObj
.
source
);
console
.
log
(
'[request message]'
,
eventObj
.
message
);
console
.
log
(
'[request message]'
,
eventObj
.
message
);
//message라는 객체로 사용자의 메세지 확인가능
request
.
post
(
request
.
post
(
//답변을 보냄-위의 reply라는 api쪽으로
{
url
:
TARGET_URL
,
headers
:
{
...
...
Experiments/messenger/ssl/app.js
View file @
31e2115
...
...
@@ -4,7 +4,7 @@ const path = require('path');
const
HTTPS
=
require
(
'https'
);
const
app
=
express
();
const
domain
=
"www.
stagefive
.tk"
const
domain
=
"www.
osschat
.tk"
const
sslport
=
23023
;
...
...
Experiments/messenger/webhook/app.js
View file @
31e2115
...
...
@@ -4,12 +4,12 @@ var app = express();
const
fs
=
require
(
'fs'
);
const
path
=
require
(
'path'
);
const
HTTPS
=
require
(
'https'
);
const
domain
=
"
도메인 변경 처리
"
const
domain
=
"
www.osschat.tk
"
const
sslport
=
23023
;
app
.
use
(
bodyParser
.
json
());
app
.
use
(
bodyParser
.
json
());
//json형태로 처리
app
.
post
(
'/hook'
,
function
(
request
,
response
)
{
app
.
post
(
'/hook'
,
function
(
request
,
response
)
{
//post방식으로 들어온다.
var
eventObj
=
request
.
body
.
events
[
0
];
var
source
=
eventObj
.
source
;
...
...
Experiments/nodejs/Assignments/app.js
deleted
100644 → 0
View file @
a743328
// mymodule.js에 정의된 모듈로 불러서 사용하도록 처리
Experiments/nodejs/Assignments/mymodule.js
deleted
100644 → 0
View file @
a743328
// 아래 2개의 함수를 모듈로 정의하는 것이 필요함
function
add
(
a
,
b
)
{
return
a
+
b
;
}
function
sub
(
a
,
b
)
{
return
a
-
b
;
}
Experiments/nodejs/Tutorial/event01/app.js
deleted
100644 → 0
View file @
a743328
var
events
=
require
(
'events'
);
var
eventEmitter
=
new
events
.
EventEmitter
();
var
connectHandler
=
function
connected
()
{
console
.
log
(
'connection successful.'
);
eventEmitter
.
emit
(
'data_received'
);
}
eventEmitter
.
on
(
'connection'
,
connectHandler
);
eventEmitter
.
on
(
'data_received'
,
function
(){
console
.
log
(
'data received successfully.'
);
});
eventEmitter
.
emit
(
'connection'
);
console
.
log
(
"Program Ended."
);
Experiments/nodejs/Tutorial/event02/app.js
deleted
100644 → 0
View file @
a743328
var
events
=
require
(
'events'
);
var
eventEmitter
=
new
events
.
EventEmitter
();
var
listner1
=
function
listner1
()
{
console
.
log
(
'listner1 executed.'
);
}
var
listner2
=
function
listner2
()
{
console
.
log
(
'listner2 executed.'
);
}
eventEmitter
.
addListener
(
'connection'
,
listner1
);
eventEmitter
.
on
(
'connection'
,
listner2
);
var
eventListeners
=
require
(
'events'
).
EventEmitter
.
listenerCount
(
eventEmitter
,
'connection'
);
console
.
log
(
eventListeners
+
" Listner(s) listening to connection event"
);
eventEmitter
.
emit
(
'connection'
);
eventEmitter
.
removeListener
(
'connection'
,
listner1
);
console
.
log
(
"Listner1 will not listen now."
);
eventEmitter
.
emit
(
'connection'
);
eventListeners
=
require
(
'events'
).
EventEmitter
.
listenerCount
(
eventEmitter
,
'connection'
);
console
.
log
(
eventListeners
+
" Listner(s) listening to connection event"
);
console
.
log
(
"Program Ended."
);
Experiments/nodejs/Tutorial/mymodule/app.js
deleted
100644 → 0
View file @
a743328
var
dt
=
require
(
'./mymodule'
);
console
.
log
(
dt
.
myDateTime
());
Experiments/nodejs/Tutorial/mymodule/mymodule.js
deleted
100644 → 0
View file @
a743328
exports
.
myDateTime
=
function
()
{
return
Date
();
};
Please
register
or
login
to post a comment