浏览代码

add online config

maguohua 8 年之前
父节点
当前提交
7e4c30e281
共有 4 个文件被更改,包括 9 次插入18 次删除
  1. 2 4
      README.md
  2. 5 0
      config/online.js
  3. 1 0
      package.json
  4. 1 14
      routes/home.js

+ 2 - 4
README.md

@@ -16,7 +16,7 @@
 
 >  部署环境 阿里云 CentOS 7.2 64位
 
->  传送门:[前端项目地址](https://github.com/bailicangdu/vue2-elm) [后台管理系统地址](https://github.com/bailicangdu/back-manage)  [原生APP项目地址](https://github.com/bailicangdu/RN-elm)
+>  传送门:[前端项目地址](https://github.com/bailicangdu/vue2-elm) [后台管理系统地址](https://github.com/bailicangdu/back-manage)  [原生APP项目地址](https://github.com/bailicangdu/RN-elm)
 
 
 ## 技术栈
@@ -34,9 +34,7 @@ cd node-elm
 
 npm install
 
-开启 mongodb
-
-npm run dev 
+npm run dev (需开启本地mongodb,如果没有安装mongodb,可以运行 npm run online 连接线上mongodb)
 
 访问: http://localhost:8001
 

+ 5 - 0
config/online.js

@@ -0,0 +1,5 @@
+'use strict';
+
+module.exports = {
+	url: 'mongodb://cangdu.org:27017/elm',
+}

+ 1 - 0
package.json

@@ -5,6 +5,7 @@
   "main": "index.js",
   "scripts": {
     "dev": "NODE_ENV=development supervisor --harmony index.js",
+    "online": "NODE_ENV=online supervisor --harmony index.js",
     "test": "echo \"Error: no test specified\" && exit 1",
     "start": "NODE_ENV=production pm2 start index.js --node-args='--harmony' --name 'node-elm'",
     "stop": "NODE_ENV=production pm2 stop index.js --name 'node-elm'",

+ 1 - 14
routes/home.js

@@ -1,23 +1,10 @@
 'use strict';
 
 import express from 'express';
-// import Food from '../models/food.js';
 const router = express.Router();
 
 router.get('/', async (req, res) => {
-	res.send('home')
-	// let foods = await Food.findOne();
-	// if(!foods){
-	// 	const test = new Food({name: '测试'});
-	// 	try{
-	// 		await test.save();
-	// 		foods = await Food.findOne();
-	// 	}catch(err){
-	// 		throw new Error(err);
-	// 	}
-	// }
-	// res.send(foods.toString());
-	
+	res.send('成功开启服务器');
 });
 
 export default router;