maguohua1 6 vuotta sitten
vanhempi
sitoutus
b966d2eaac
2 muutettua tiedostoa jossa 4 lisäystä ja 6 poistoa
  1. 2 6
      app.js
  2. 2 0
      config/.gitignore

+ 2 - 6
app.js

@@ -17,14 +17,10 @@ const app = express();
 app.all('*', (req, res, next) => {
 	res.header("Access-Control-Allow-Origin", req.headers.origin || req.headers.referer || '*');
 	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-Methods", "PUT,POST,GET,DELETE");
   res.header("Access-Control-Allow-Credentials", true); //可以带cookies
 	res.header("X-Powered-By", 'Express');
-	if (req.method == 'OPTIONS') {
-  	res.sendStatus(200);
-	} else {
-    next();
-	}
+  next();
 });
 
 // app.use(Statistic.apiRecord)

+ 2 - 0
config/.gitignore

@@ -0,0 +1,2 @@
+# Ignore everything in this directory
+production.js