Skip to content

Instantly share code, notes, and snippets.

@xgqfrms-GitHub
Last active August 8, 2017 06:52
Show Gist options
  • Save xgqfrms-GitHub/0d36bd446ecb639d5b3b3c7e2e64cf81 to your computer and use it in GitHub Desktop.
Save xgqfrms-GitHub/0d36bd446ecb639d5b3b3c7e2e64cf81 to your computer and use it in GitHub Desktop.
CORS-Express

CORS-Express

https://www.w3.org/wiki/CORS

https://enable-cors.org/server_expressjs.html

https://github.com/monsur/enable-cors.org

app.use(function(req, res, next) {
  res.header("Access-Control-Allow-Origin", "*");
  res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
  next();
});

app.get('/', function(req, res, next) {
  // Handle the get for this route
});

app.post('/', function(req, res, next) {
 // Handle the post for this route
});

https://stackoverflow.com/questions/11181546/how-to-enable-cross-origin-resource-sharing-cors-in-the-express-js-framework-o

var express = require('express')
  , app = express.createServer();

app.get('/', function (req, res, next) {
    res.header("Access-Control-Allow-Origin", "*");
    res.header("Access-Control-Allow-Headers", "X-Requested-With");
    next();
});

app.configure(function () {
    app.use(express.methodOverride());
    app.use(express.bodyParser());
    app.use(app.router);
});

app.configure('development', function () {

    app.use(express.static(__dirname + '/public'));
    app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
});

app.configure('production', function () {


    var oneYear = 31557600000;
    //    app.use(express.static(__dirname + '/public', { maxAge: oneYear }));
    app.use(express.static(__dirname + '/public'));
    app.use(express.errorHandler());
});

app.listen(8888);
console.log('express running at http://localhost:%d', 8888);

https://stackoverflow.com/questions/5916900/how-can-you-detect-the-version-of-a-browser

@xgqfrms-GitHub
Copy link
Author

chrome://chrome-urls/

https://www.cnblogs.com/laden666666/p/5544572.html

chrome://flags/

@xgqfrms-GitHub
Copy link
Author

"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --disable-web-security --user-data-dir=D:\Chrome

"C:\Program Files (x86)\Google\Chrome\Application"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment