daily pastebin goal
70%
SHARE
TWEET

Untitled

a guest Nov 16th, 2014 154 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var express= require('express');
  2.  
  3. var app = express();
  4. app.use(allowCrossDomain);
  5.  
  6. app.options( function(){
  7.     conosle.log('wwfwfwfw');
  8. })
  9.  
  10. app.all( function(){
  11.     console.log('asdfasdfasf');
  12. })
  13.  
  14. app.use( function(req,res,next){
  15.  
  16.     console.log('wtf');
  17.  
  18. });
  19.  
  20.  
  21.  
  22. app.listen(8080);
  23.  
  24. function allowCrossDomain(req, res, next) {
  25.     res.header('Access-Control-Allow-Origin', '*');
  26.     res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS');
  27.     res.header('Access-Control-Allow-Headers', 'Content-Type');
  28.     console.log('okkkkk');
  29.     // intercept OPTIONS method
  30.     if ('OPTIONS' == req.method) {
  31.         res.send(200);
  32.     }
  33.     else {
  34.         next();
  35.     }
  36. };
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top