mirror of
https://github.com/microsoft/Web-Dev-For-Beginners.git
synced 2025-08-13 18:24:33 +02:00
fix Express CORS support for 127.0.0.1 (closes #92)
Co-authored-by: qiaodong <qiaodong6733@dingtalk.com>
This commit is contained in:
@@ -27,7 +27,7 @@ const db = {
|
||||
const app = express();
|
||||
app.use(bodyParser.urlencoded({ extended: true }));
|
||||
app.use(bodyParser.json());
|
||||
app.use(cors({ origin: /http:\/\/localhost/ }));
|
||||
app.use(cors({ origin: /http:\/\/(127(\.\d){3}|localhost)/}));
|
||||
app.options('*', cors());
|
||||
|
||||
// ***************************************************************************
|
||||
|
Reference in New Issue
Block a user