12345678910111213141516171819202122232425262728 |
- 'use strict';
- /**
- * @param {Egg.Application} app - egg application
- */
- const os = require('os');
- function getIPAdress() {
- const interfaces = os.networkInterfaces();
- for (const devName in interfaces) {
- const iface = interfaces[devName];
- for (let i = 0; i < iface.length; i++) {
- const alias = iface[i];
- if (alias.family === 'IPv4' && alias.address !== '127.0.0.1' && !alias.internal) {
- return alias.address;
- }
- }
- }
- }
- module.exports = app => {
- const { router, controller } = app;
- const { routePrefix, cluster } = app.config;
- const ipAddress = getIPAdress();
- console.log(`前缀:http://${ipAddress}:${cluster.listen.port}${routePrefix}`);
- router.get('/', controller.home.index);
- require('./z_router/apply')(app); // 申请
- require('./z_router/checkRecord')(app); // 审核
- require('./z_router/reviewExpert')(app); // 评审专家
- };
|