當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript express.cookieParser函數代碼示例

本文整理匯總了TypeScript中express.cookieParser函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript cookieParser函數的具體用法?TypeScript cookieParser怎麽用?TypeScript cookieParser使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了cookieParser函數的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1:

app.configure(function () {
    app.use(express.static('public'));
    app.use(express.cookieParser());
    app.use(express.bodyParser());
    app.use(express.session({ secret: 'keyboard cat' }));
    app.use(passport.initialize());
    app.use(passport.session());
    app.use(app.router);
});
開發者ID:dpwolfe,項目名稱:nko4-siecieborowice,代碼行數:9,代碼來源:server.ts

示例2: done

                     }
                  },replace);
               }
               else {
                  if (!--pending) {
                     done(null, results);
                  }
               }
            });
         });
      });
   };


   server.use(express.bodyParser());
   server.use(express.cookieParser());
   server.use(express.compress());
   server.get('/', function (req, res) {
      res.render(path.resolve(__dirname, '../app.html'));
   });

   var cachedFiles:any[] = null;
   /**
    * A Quick demo hack for enumerating system files.  Calculate this once and cache it, because
    * it could potentially be an expensive operation, and we'll be running on slow ass free Heroku
    * servers.
    */
   server.get('/files', function (req, res) {
      if(cachedFiles){
         res.json(cachedFiles,200);
         res.end();
開發者ID:justindujardin,項目名稱:pow-edit,代碼行數:31,代碼來源:server.ts

示例3:

// all environments
app.use(express.limit('70mb'));
app.use(express.json({limit: '70mb'}));
app.use(express.urlencoded({limit: '70mb'}));
app.set('port', process.env.PORT || 3000);
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');
app.set('view options', {pretty: config.isProd()});
app.locals.pretty = !config.isProd();
app.use(express.favicon());
app.use(express.logger('dev'));
app.use(express.json());
app.use(express.urlencoded());
app.use(express.methodOverride());
app.use(express.cookieParser('your secret here'));
app.use(express.session());
if (!config.isProd()) {
    app.use(allowCrossDomain);
}
app.use(app.router);
app.use(express.static(path.join(__dirname, 'public')));
app.use(express.bodyParser());

//if ('development' == app.get('env')) {
if (false) {
    mailer.extend(app, config.getDevMailCredentials());
} else {
    mailer.extend(app, config.getProdMailCredentials());
}
開發者ID:arein,項目名稱:Mils-Server,代碼行數:29,代碼來源:app.ts

示例4: done

  ownerName: String,
  ownerID: ObjectId,
  info: String,
  attendeesNames: [String],
  attendeesIDs: [ObjectId]
});

//Mongoose collections
var User = mongoose.model('User', UserSchema, 'users');
var Building = mongoose.model('Building', BuildingSchema, 'buildings');
var AnEvent = mongoose.model('Event', EventSchema, 'events');
var Class = mongoose.model('Class', ClassSchema, 'classes');

// the bodyParser middleware allows us to parse the
// body of a request
app.use(express.cookieParser());
app.use(express.bodyParser());
app.use(express.session({ secret: 'keyboard cat' }));
app.use(passport.initialize());
app.use(passport.session());
app.use(app.router);
app.use(express.static(__dirname));

/*******************************************************************************************/
//Passport setup

passport.serializeUser(function(user, done) {
  done(null, user);
});

passport.deserializeUser(function(user, done) {
開發者ID:mhankowsky,項目名稱:studyshare,代碼行數:31,代碼來源:app.ts


注:本文中的express.cookieParser函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。