You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.
// Completely override Express middleware loading.
// If you only want to override the bodyParser, cookieParser
// or methodOverride middleware, see the appropriate keys below.
// If you only want to override one or more of the default middleware,
// but keep the order the same, use the middleware key.
// See the http hook in the Sails core for the default loading order.
//
// loadMiddleware: function( app, defaultMiddleware, sails ) { ... }
// Override one or more of the default middleware (besides bodyParser, cookieParser)
//
// middleware: {
// session: false, // turn off session completely for HTTP requests
// 404: function ( req, res, next ) { ... your custom 404 middleware ... }
// }
// The middleware function used for parsing the HTTP request body.
// (this most commonly comes up in the context of file uploads)
//
// Defaults to a slightly modified version of express.bodyParser, i.e.:
// If the Connect bodyParser doesn't understand the HTTP body request
// data, Sails runs it again with an artificial header, forcing it to try
// and parse the request body as JSON. (this allows JSON to be used as your
// request data without the need to specify a 'Content-type: application/json'
// header)
//
// If you want to change any of that, you can override the bodyParser with
// your own custom middleware:
// bodyParser: function customBodyParser (options) { ... return function(req, res, next) {...}; }
//
// Or you can always revert back to the vanilla parser built-in to Connect/Express:
// bodyParser: require('express').bodyParser,
//
// Or to disable the body parser completely:
// bodyParser: false,
// (useful for streaming file uploads-- to disk or S3 or wherever you like)
//
// WARNING
// ======================================================================
// Multipart bodyParser (i.e. express.multipart() ) will be removed
// in Connect 3 / Express 4.
// Why?
//
// The multipart component of this parser will be replaced
// in a subsequent version of Sails (after v0.10, probably v0.11) with:
// file-parser
// (or something comparable)
//
// If you understand the risks of using the multipart bodyParser,
// and would like to disable the warning log messages, uncomment:
// silenceMultipartWarning: true,
// ======================================================================
// Cookie parser middleware to use
// (or false to disable)
//
// Defaults to express.cookieParser
//
// Example override:
// cookieParser: (function customMethodOverride (req, res, next) {})(),
// HTTP method override middleware
// (or false to disable)
//
// This option allows artificial query params to be passed to trick
// Sails into thinking a different HTTP verb was used.
// Useful when supporting an API for user-agents which don't allow
// PUT or DELETE requests
//
// Defaults to express.methodOverride
//
// Example override:
// methodOverride: (function customMethodOverride (req, res, next) {})()
};
/**
HTTP Flat-File Cache
*
These settings are for Express' static middleware- the part that serves
flat-files like images, css, client-side templates, favicons, etc.
*
In Sails, this affects the files in your app's assets directory.
By default, Sails uses your project's Gruntfile to compile/copy those
assets to .tmp/public, where they're accessible to Express.
*
The HTTP static cache is only active in a 'production' environment,
since that's the only time Express will cache flat-files.
*
Could be possible. They changed a lot from 0.9 to 0.10. But as your problem is not related to this example, i would close it. For general sails.js question, please visit http://sailsjs.org/#/support.
Could be possible. They changed a lot from 0.9 to 0.10. But as your problem is not related to this example, i would close this issue. For general sails.js question, please visit http://sailsjs.org/#/support.
—
Reply to this email directly or view it on GitHub.
I'm calling this in my UserController , while the great Google login screen appears , and I can sign in , I never get my log statement .
google: function(req, res) {
passport.authenticate('google', { failureRedirect: '/login', scope: ['email'] }, function(err, user) {
},
Here's a copy of my express.js file with my keys taken out , I'm trying to run a basic log statement here too...
var passport = require('passport')
var verifyHandler = function(token, tokenSecret, profile, done) {
sails.log("p" ) ;
process.nextTick(function() {
});
};
passport.serializeUser(function(user, done) {
done(null, user.uid);
});
passport.deserializeUser(function(uid, done) {
User.findOne({uid: uid}, function(err, user) {
done(err, user);
});
});
/**
Configure advanced options for the Express server inside of Sails.
*
For more information on configuration, check out:
http://sailsjs.org/#documentation
*/
module.exports.http = {
customMiddleware: function(app) {
passport.use(new GoogleStrategy({
clientID: 'actualID',
clientSecret: 'actualSecret',
returnURL: 'http://localhost:1337/auth/google/callback',
callbackURL: 'http://localhost:1337/auth/google/callback',
onSuccess:verifyHandler
}, verifyHandler));
app.use(passport.initialize());
app.use(passport.session());
}
// Completely override Express middleware loading.
// If you only want to override the bodyParser, cookieParser
// or methodOverride middleware, see the appropriate keys below.
// If you only want to override one or more of the default middleware,
// but keep the order the same, use the
middleware
key.// See the
http
hook in the Sails core for the default loading order.//
// loadMiddleware: function( app, defaultMiddleware, sails ) { ... }
// Override one or more of the default middleware (besides bodyParser, cookieParser)
//
// middleware: {
// session: false, // turn off session completely for HTTP requests
// 404: function ( req, res, next ) { ... your custom 404 middleware ... }
// }
// The middleware function used for parsing the HTTP request body.
// (this most commonly comes up in the context of file uploads)
//
// Defaults to a slightly modified version of
express.bodyParser
, i.e.:// If the Connect
bodyParser
doesn't understand the HTTP body request// data, Sails runs it again with an artificial header, forcing it to try
// and parse the request body as JSON. (this allows JSON to be used as your
// request data without the need to specify a 'Content-type: application/json'
// header)
//
// If you want to change any of that, you can override the bodyParser with
// your own custom middleware:
// bodyParser: function customBodyParser (options) { ... return function(req, res, next) {...}; }
//
// Or you can always revert back to the vanilla parser built-in to Connect/Express:
// bodyParser: require('express').bodyParser,
//
// Or to disable the body parser completely:
// bodyParser: false,
// (useful for streaming file uploads-- to disk or S3 or wherever you like)
//
// WARNING
// ======================================================================
// Multipart bodyParser (i.e. express.multipart() ) will be removed
// in Connect 3 / Express 4.
// Why?
//
// The multipart component of this parser will be replaced
// in a subsequent version of Sails (after v0.10, probably v0.11) with:
// file-parser
// (or something comparable)
//
// If you understand the risks of using the multipart bodyParser,
// and would like to disable the warning log messages, uncomment:
// silenceMultipartWarning: true,
// ======================================================================
// Cookie parser middleware to use
// (or false to disable)
//
// Defaults to
express.cookieParser
//
// Example override:
// cookieParser: (function customMethodOverride (req, res, next) {})(),
// HTTP method override middleware
// (or false to disable)
//
// This option allows artificial query params to be passed to trick
// Sails into thinking a different HTTP verb was used.
// Useful when supporting an API for user-agents which don't allow
// PUT or DELETE requests
//
// Defaults to
express.methodOverride
//
// Example override:
// methodOverride: (function customMethodOverride (req, res, next) {})()
};
/**
HTTP Flat-File Cache
*
These settings are for Express' static middleware- the part that serves
flat-files like images, css, client-side templates, favicons, etc.
*
In Sails, this affects the files in your app's
assets
directory.By default, Sails uses your project's Gruntfile to compile/copy those
assets to
.tmp/public
, where they're accessible to Express.*
The HTTP static cache is only active in a 'production' environment,
since that's the only time Express will cache flat-files.
*
For more information on configuration, check out:
http://sailsjs.org/#documentation
*/
module.exports.cache = {
// The number of seconds to cache files being served from disk
// (only works in production mode)
maxAge: 31557600000
};
The text was updated successfully, but these errors were encountered: