Ivan Asmer 5 years ago
parent
commit
d8a9ebb589
1 changed files with 2 additions and 2 deletions
  1. 2 2
      index.js

+ 2 - 2
index.js

@@ -6,7 +6,8 @@ const express_graphql   = require('express-graphql');
 const { buildSchema, printSchema } = require('graphql');
 const expand = require('mm-graphql/expand')
 const fs     = require('fs')
-const upload  = require('multer')({ dest: `${__dirname}/public/images` })
+const uploadPath = `${__dirname}/public/images/`;
+const upload  = require('multer')({ dest: uploadPath })
 
 
 ;(async () => {
@@ -147,7 +148,6 @@ const upload  = require('multer')({ dest: `${__dirname}/public/images` })
     app.use('/graphql', express_graphql(jwtGQL({anonSchema, anonResolvers, schema, createContext: getModels, graphiql: true, secret: jwtSecret})))
 
 
-    const uploadPath = `${__dirname}/public/images/`;
     app.post('/upload', upload.single('photo'), async (req, res, next) => {
         let decoded;
         if (decoded = jwtCheck(req, jwtSecret)){