Files
cm-app-amazon/index.js

35 lines
703 B
JavaScript

const port = 21001
, express = require("express")
, fetch = require("node-fetch")
, cron = require('node-cron')
, logger = require('logops')
, db = require('./src/model');
const SyncItem = {
data: {
url: 'http://127.0.0.1:30001',
},
methods: {
syncItemStockAmount: () => {
return fetch(SyncItem.data.url + '/amazon/')
.then(res => res.text())
.then(body => {
});
}
}
}
cron.schedule('0 0,20,40 * * * *', () => {
SyncItem.methods.syncItemStockAmount();
});
var app = express();
app.listen(port, () => {
SyncItem.methods.syncItemStockAmount();
logger.info({ port: port }, "Server started...");
});