您好我是NodeJs的新手,我一直在关注本教程http://code.tutsplus.com/tutorials/authenticating-nodejs-applications-with-passport--cms-21619来创建一个带有身份验证的应用程序.我试图遵循教程中的所有结构和代码(代码在github上https://github.com/tutsplus/passport-mongo)但是当我在浏览器中打开我的应用程序时出现错误此错误
TypeError:passport.authenticate不是module.exports的函数(C:\ myApp\routes\index.js:24:34)
这是我的index.js路由文件
var express = require('express');
var router = express.Router();
var passport = require('passport');
var isAuthenticated = function (req, res, next) {
// if user is authenticated in the session, call the next() to call the next request handler
// Passport adds this method to request object. A middleware is allowed to add properties to
// request and response objects
if (req.isAuthenticated())
return next();
// if the user is not authenticated then redirect him …Run Code Online (Sandbox Code Playgroud) 我正在尝试执行与数组比较的函数,如果它们相同则返回true.现在数组很简单,稍后会推进但我仍然坚持使用该testEqual功能.所以这是代码
int n = 5;
int array[5] = {5,10,3,4,7};
bubbleSort(pole,n);
int array2[5] = {3,4,5,7,10};
testEqual( array , array2 , "bubbleSort");
Run Code Online (Sandbox Code Playgroud)
这是testEqual我需要在阵列上重制的功能,但我不知道如何.
bool testEqual(int i1, int i2, const string testName) {
bool myresult = (i1 == i2);
return myresult;
}
Run Code Online (Sandbox Code Playgroud)
像bubbleSort这样的其他功能很好,我只需要重新制作testEqual.