- copy一个config.js文件到项目根目录,记得一定要更改最下面的log日志的输出路径(自己可以新建个文件夹,将完整路径配置上),config文件如下所示:
module.exports = {
// 服务端口
port: 9000,
// Web接口域名
whost: 'https://qaapi.qdingnet.com',
// whost: 'http://10.37.241.165:8081',
// whost: 'https://api.qdingnet.com',
// whost: 'http://devboss.qdingnet.com',
// whost: 'http://devzszy.qdingnet.com',//房屋租售
// 模板是否缓存
templateCache: false,
// // 启动模式
startMode: 'console', //console deploy
// 数据库
database: {
// host: '10.37.253.31',
// port: '3307',
// username: 'dev',
// password: '458kT*!W',
// dbname: 'qding_market_activity',
// dialect: 'mysql',
host: '127.0.0.1',
port: '3306',
username: 'root',
password: '123456',
dbname: 'mydatabase',
dialect: 'mysql',
},
// REDIS
redis: {
// host: '10.37.251.53',
// port: '6378',
host: '127.0.0.1', //本地安装的
port: '6379',
},
// // 负载均衡
cluster: 4,
// // thrift
// thrift: {
// host: '10.37.253.200',
// port: 9998
// }
logger: '/Users/zhuzhaoyang/logs/mobile-qd',
};
- 配置host文件,进入/etc/hosts/,打开hosts文件,确保文件里包含127.0.0.1 devm.iqdnet.com,完成文件如下所示:
-
## # Host Database # # localhost is used to configure the loopback interface # when the system is booting. Do not change this entry. ## 127.0.0.1 localhost 255.255.255.255 broadcasthost ::1 localhost # 127.0.0.1 devm.qdingnet.com # 127.0.0.1 devm.iqdnet.com 127.0.0.1 qam.iqdnet.com 10.37.251.63 devpatrol.qdingnet.com 10.37.251.63 nbetaac.qdingnet.com 127.0.0.1 qatm.iqdnet.com 127.0.0.1 devtm.iqdnet.com
- 查看是否已经安装node 、nodemon 、yarn、nginx、redis,如果没有,则全局安装:
npm install n -g
npm install -g nodemon
npm install yarn -g
brew install nginx
brew install redis
- 在项目根目录下起nginx执行命令:brew services start nginx
- 在项目根目录下起redis执行命令:brew services start redis
- 进入到项目的static 目录下,依次执行如下命令:1.sudo yarn ; 2.sudo yarn start
- 进入到resource目录下,在进入其子目录vue,依次执行如下命令:1.sudo yarn ; 2.sudo yarn watch
- 在项目的根目录下执行:sudo nodemon --watch app server.js,启动。
- 在浏览器里访问路径即可:比如(http://devm.iqdnet.com/disease/list)