the case of the missing file
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
const createAuthHeaderFromCookie = (req, _, next) => {
|
||||
if (process.env.NODE_ENV !== 'production' || this.config.productionGraphQLPlayground) {
|
||||
const existingAuthHeader = req.get('Authorization');
|
||||
const { token } = req.cookies;
|
||||
|
||||
if (!existingAuthHeader && token) {
|
||||
req.headers.authorization = `JWT ${token}`;
|
||||
}
|
||||
}
|
||||
|
||||
next();
|
||||
};
|
||||
|
||||
module.exports = createAuthHeaderFromCookie;
|
||||
|
||||
@@ -56,7 +56,7 @@ class Payload {
|
||||
this.config.routes.graphQL,
|
||||
createAuthHeaderFromCookie,
|
||||
passport.authenticate(['jwt', 'anonymous'], { session: false }),
|
||||
new GraphQL(this.config, this.collections, this.User, this.Upload, this.globals),
|
||||
new GraphQL(this.config, this.collections, this.User, this.Upload, this.globals).init(),
|
||||
);
|
||||
|
||||
this.router.get(this.config.routes.graphQLPlayground, graphQLPlayground({
|
||||
|
||||
@@ -11,6 +11,7 @@ const connectMongoose = async (url) => {
|
||||
urlToConnect = await mongod.getUri();
|
||||
successfulConnectionMessage = 'Connected to in-memory Mongo server successfully!';
|
||||
}
|
||||
|
||||
mongoose.connect(urlToConnect, {
|
||||
useNewUrlParser: true,
|
||||
useUnifiedTopology: true,
|
||||
|
||||
Reference in New Issue
Block a user