Ver Fonte

压缩图片

maguohua1 há 6 anos atrás
pai
commit
fe2f9fa960

+ 4 - 1
README.md

@@ -249,10 +249,13 @@ npm run dev
 ```
 
 
+# Donate
+如果觉得这个项目对您有帮助,可以资助一下作者,您的资助将会用做维持服务器的运行。(毕竟服务器对作者来说是一个不小的开销😂)
+
+<img src="https://github.com/bailicangdu/node-elm/blob/master/screenshots/pay.png" width="440" height="250"/>
 
 
 # License
 
 [GPL](https://github.com/bailicangdu/node-elm/blob/master/COPYING)
 
-

+ 2 - 2
app.js

@@ -18,8 +18,8 @@ app.all('*', (req, res, next) => {
 	res.header("Access-Control-Allow-Origin", req.headers.Origin || req.headers.origin || 'https://cangdu.org');
 	res.header("Access-Control-Allow-Headers", "Content-Type, Authorization, X-Requested-With");
 	res.header("Access-Control-Allow-Methods", "PUT,POST,GET,DELETE,OPTIONS");
-  	res.header("Access-Control-Allow-Credentials", true); //可以带cookies
-	res.header("X-Powered-By", '3.2.1')
+  res.header("Access-Control-Allow-Credentials", true); //可以带cookies
+	res.header("X-Powered-By", 'Express');
 	if (req.method == 'OPTIONS') {
 	  	res.sendStatus(200);
 	} else {

+ 1 - 1
config/default.js

@@ -1,7 +1,7 @@
 'use strict';
 
 module.exports = {
-	port: 8001,
+	port: parseInt(process.env.PORT, 10) || 8001,
 	url: 'mongodb://localhost:27017/elm',
 	session: {
 		name: 'SID',

+ 33 - 0
ecosystem.config.js

@@ -0,0 +1,33 @@
+module.exports = {
+  apps : [{
+    name: 'node-elm',
+    script: 'index.js',
+    instances: 1 ,
+    autorestart: true,
+    watch: false,
+    max_memory_restart: '1G',
+    output: 'logs/out.log',
+    error: 'logs/error.log',
+    log: 'logs/combined.outerr.log',
+    env: {
+      NODE_ENV: 'development'
+    },
+    env_production: {
+      NODE_ENV: 'production',
+      HOST: '0.0.0.0',
+      PORT: 8001,
+    }
+  }],
+  deploy: {
+    production: {
+      user: 'root',
+      host: ['139.224.234.213'],
+      port: '22',
+      ref : 'origin/master',
+      repo: 'git@github.com:bailicangdu/node-elm.git',
+      path: '/root/mygit/node-elm',
+      'ssh_options': 'StrictHostKeyChecking=no',
+      'post-deploy': 'npm install && pm2 reload ecosystem.config.js --env production',
+    }
+  }
+};

+ 1 - 3
package.json

@@ -10,9 +10,7 @@
     "dev": "cross-env NODE_ENV=development supervisor --harmony index.js",
     "check": "cross-env NODE_ENV=check supervisor  --harmony index.js",
     "test": "echo \"Error: no test specified\" && exit 1",
-    "start": "cross-env NODE_ENV=production pm2 start index.js --node-args='--harmony' --name 'node-elm --port 8001'",
-    "stop": "cross-env NODE_ENV=production pm2 stop index.js --name 'node-elm --port 8001'",
-    "restart": "cross-env NODE_ENV=production pm2 restart index.js --node-args='--harmony' --name 'node-elm --port 8001'"
+    "deploy": "pm2 deploy production"
   },
   "repository": {
     "type": "git",

BIN
screenshots/elm_msite.png


BIN
screenshots/elm_shop.png


BIN
screenshots/ewm.png


BIN
screenshots/manage_home.png


BIN
screenshots/manage_shop.png


BIN
screenshots/pay.png


+ 0 - 3
start.sh

@@ -1,3 +0,0 @@
-#start server
-
-npm start

+ 0 - 3
stop.sh

@@ -1,3 +0,0 @@
-#stop server
-
-npm stop

+ 1 - 1
views/index.html

@@ -8,7 +8,7 @@
     <meta name="format-detection" content="telephone=no">
     <meta name="full-screen" content="yes">
     <meta name="x5-fullscreen" content="true">
-    <title>外卖生态圈之前端</title>
+    <title>test</title>
   <link href="/elm/static/css/app.css" rel="stylesheet"></head>
   <body>
     <div id="app">