crawler.js 567 Bytes
/**
 * run
 * Created by lintry on 2020/1/28.
 */
const _ = require('lodash');
const config = global.config;
const dbo = global.sequelize;
const DataImporter = require('../service/data_importer');
const data_importer = new DataImporter(dbo);
const NCOV_URL = config.NCOV_API.area.url;
const NCOV_PARAM = config.NCOV_API.area.param;
const Result = require('kml-express-stage-lib').Result;

module.exports = async (cfg) => {
    await data_importer.import_url(NCOV_URL, _.merge({latest: 0}, NCOV_PARAM))
    return Result.Ok(`Fetched from ${NCOV_URL}`, NCOV_PARAM);
};