Toggle navigation
Toggle navigation
This project
Loading...
Sign in
이진영
/
stockAlarm
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Ubuntu
2021-06-08 10:14:27 +0000
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
ca36d149d2670b611efd957157614df2c8ac6024
ca36d149
1 parent
5f91ffff
Add node-cron
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
0 deletions
app.js
package-lock.json
app.js
View file @
ca36d14
...
...
@@ -11,8 +11,11 @@ const bodyParser = require('body-parser');
const
axios
=
require
(
'axios'
)
const
cheerio
=
require
(
'cheerio'
)
var
app
=
express
();
var
cron
=
require
(
'node-cron'
);
app
.
use
(
bodyParser
.
json
());
app
.
post
(
'/hook'
,
function
(
req
,
res
)
{
var
eventObj
=
req
.
body
.
events
[
0
];
...
...
@@ -25,6 +28,8 @@ app.post('/hook', function (req, res) {
console
.
log
(
'[request source] '
,
eventObj
.
source
);
console
.
log
(
'[request message]'
,
eventObj
.
message
);
cron
.
schedule
(
'*/5 * * * *'
,
()
=>
{
const
temp
=
axios
.
get
(
`https://finance.naver.com/item/main.nhn?code=
${
stock_code
}
%22`
).
then
(
res
=>
{
let
urList
=
[];
...
...
@@ -34,6 +39,8 @@ app.post('/hook', function (req, res) {
console
.
log
(
result
)
}
)
});
request
.
post
(
{
...
...
package-lock.json
View file @
ca36d14
...
...
@@ -528,6 +528,19 @@
"mime-db"
:
"1.48.0"
}
},
"moment"
:
{
"version"
:
"2.29.1"
,
"resolved"
:
"https://registry.npmjs.org/moment/-/moment-2.29.1.tgz"
,
"integrity"
:
"sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ=="
},
"moment-timezone"
:
{
"version"
:
"0.5.33"
,
"resolved"
:
"https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.33.tgz"
,
"integrity"
:
"sha512-PTc2vcT8K9J5/9rDEPe5czSIKgLoGsH8UNpA4qZTVw0Vd/Uz19geE9abbIOQKaAQFcnQ3v5YEXrbSc5BpshH+w=="
,
"requires"
:
{
"moment"
:
">= 2.9.0"
}
},
"ms"
:
{
"version"
:
"2.0.0"
,
"resolved"
:
"https://registry.npmjs.org/ms/-/ms-2.0.0.tgz"
,
...
...
@@ -538,6 +551,14 @@
"resolved"
:
"https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz"
,
"integrity"
:
"sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw=="
},
"node-cron"
:
{
"version"
:
"3.0.0"
,
"resolved"
:
"https://registry.npmjs.org/node-cron/-/node-cron-3.0.0.tgz"
,
"integrity"
:
"sha512-DDwIvvuCwrNiaU7HEivFDULcaQualDv7KoNlB/UU1wPW0n1tDEmBJKhEIE6DlF2FuoOHcNbLJ8ITL2Iv/3AWmA=="
,
"requires"
:
{
"moment-timezone"
:
"^0.5.31"
}
},
"nth-check"
:
{
"version"
:
"2.0.0"
,
"resolved"
:
"https://registry.npmjs.org/nth-check/-/nth-check-2.0.0.tgz"
,
...
...
Please
register
or
login
to post a comment