next-auth
Advanced tools
Comparing version 1.5.1 to 1.6.0
{ | ||
"name": "next-auth-examples", | ||
"version": "1.5.1", | ||
"version": "1.6.0", | ||
"description": "An example project for next-auth", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/iaincollins/next-auth.git", |
51
index.js
@@ -84,2 +84,11 @@ 'use strict' | ||
// If an instance of nextApp was passed, let all requests to /_next/* pass | ||
// to it *before* Express Session and other middleware is called. | ||
if (nextApp) { | ||
expressApp.all('/_next/*', (req, res) => { | ||
let nextRequestHandler = nextApp.getRequestHandler() | ||
return nextRequestHandler(req, res) | ||
}) | ||
} | ||
/** | ||
@@ -344,9 +353,15 @@ * Set up cookie parsing, body parsing, express sessions and add Cross Site | ||
/** | ||
* If a port has been specified, then set Next.js as the default final | ||
* route hanlder and start listening on the specified port. | ||
*/ | ||
if (port) { | ||
return new Promise((resolve, reject) => { | ||
let response = { | ||
next: nextApp, | ||
express: expressApp, | ||
functions: functions, | ||
providers: providers, | ||
port: port | ||
} | ||
// If instance of nextApp passed have it handle all other routes by default | ||
// If no port specified, don't start Express automatically | ||
if (!port) resolve(response) | ||
// If an instance of nextApp was passed, have it handle all other routes | ||
if (nextApp) { | ||
@@ -358,21 +373,13 @@ expressApp.all('*', (req, res) => { | ||
} | ||
// Start Express | ||
return expressApp.listen(port, err => { | ||
if (err) Promise.reject(err) | ||
return Promise.resolve({ | ||
next: nextApp, | ||
express: expressApp, | ||
functions: functions, | ||
providers: providers | ||
}) | ||
if (err) reject(err) | ||
return resolve(response) | ||
}) | ||
} else { | ||
return Promise.resolve({ | ||
next: nextApp, | ||
express: expressApp, | ||
functions: functions, | ||
providers: providers | ||
}) | ||
} | ||
}) | ||
.then(() => { | ||
return Promise.resolve() | ||
}) | ||
} |
{ | ||
"name": "next-auth", | ||
"version": "1.5.1", | ||
"version": "1.6.0", | ||
"description": "An authentication library for Next.js", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/iaincollins/next-auth.git", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
105771
1895