schangxiang@126.com
2025-09-09 3d8966ba2c81e7e0365c8b123e861d18ee4f94f5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
"use strict";
import { createConnections } from "typeorm";
 
module.exports = app => {
  app.beforeStart(async () => {
    // 示例:启动的时候去读取 https://registry.npmjs.com/egg/latest 的版本信息
    // const result = await app.curl('https://registry.npmjs.com/egg/latest', {
    //   dataType: 'json',
    // });
    // app.logger.info('-------------egg latest version------------: %s', result.data.version);
 
    createConnections()
      .then(async connection => {
        let index = 0;
        for (let item of connection) {
          console.log(`createConnection success,name${index}:`, item.name);
          index++;
        }
 
        // await app.runSchedule("idcardMobile"); // 手动触发日志
      })
      .catch(error => console.log("TypeORM connection error: ", error));
  });
};