egg3.0 project configuration listening port

egg configuration listening port

cluster: {
    
    
  listen: {
    
    
    port: 55555,
    hostname: '127.0.0.1', // 不建议设置 hostname 为 '0.0.0.0',它将允许来自外部网络和来源的连接,请在知晓风险的情况下使用
  },
},

config\config.default.js

'use strict';

/**
 * @param {Egg.EggAppInfo} appInfo app info
 */
module.exports = appInfo => {
    
    
  /**
   * built-in config
   * @type {Egg.EggAppConfig}
   **/
  const config = exports = {
    
    
    // 支持post请求
    security: {
    
    
      csrf: {
    
    
        enable: false,
      },
    },
    cluster: {
    
    
      listen: {
    
    
        port: 55555,
        hostname: '127.0.0.1', // 不建议设置 hostname 为 '0.0.0.0',它将允许来自外部网络和来源的连接,请在知晓风险的情况下使用
      },
    },
    mongoose: {
    
    
      client: {
    
    
        // 链接到本地的MongoDB,note是我本地数据库的名字
        url: 'mongodb://127.0.0.1:27017/note',
        options: {
    
    
          // dbName: 'note',
          useNewUrlParser: true,
        },
      },
    },
    view: {
    
    
      defaultViewEngine: 'nunjucks',
      mapping: {
    
    
        '.tpl': 'nunjucks',
      },
    },

  };

  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + '_1682063943419_2410';

  // add your middleware config here
  config.middleware = [];

  // add your user config here
  const userConfig = {
    
    
    // myAppName: 'egg',
  };

  return {
    
    
    ...config,
    ...userConfig,
  };
};

postwoman call interface

insert image description here

insert image description here

Guess you like

Origin blog.csdn.net/weixin_40119412/article/details/130373555