mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
use graphql-upload middleware
This commit is contained in:
parent
02a29cc954
commit
a7e426a92f
7
backend/src/schema/resolvers/Upload.js
Normal file
7
backend/src/schema/resolvers/Upload.js
Normal file
@ -0,0 +1,7 @@
|
||||
import { GraphQLUpload } from 'graphql-upload'
|
||||
|
||||
export default {
|
||||
// This maps the `Upload` scalar to the implementation provided
|
||||
// by the `graphql-upload` package.
|
||||
Upload: GraphQLUpload,
|
||||
}
|
||||
@ -12,6 +12,7 @@ import { RedisPubSub } from 'graphql-redis-subscriptions'
|
||||
import { PubSub } from 'graphql-subscriptions'
|
||||
import Redis from 'ioredis'
|
||||
import bodyParser from 'body-parser'
|
||||
import { graphqlUploadExpress } from 'graphql-upload'
|
||||
|
||||
export const NOTIFICATION_ADDED = 'NOTIFICATION_ADDED'
|
||||
const { REDIS_DOMAIN, REDIS_PORT, REDIS_PASSWORD } = CONFIG
|
||||
@ -67,6 +68,7 @@ const createServer = (options) => {
|
||||
},
|
||||
},
|
||||
debug: !!CONFIG.DEBUG,
|
||||
uploads: false,
|
||||
tracing: !!CONFIG.DEBUG,
|
||||
formatError: (error) => {
|
||||
if (error.message === 'ERROR_VALIDATION') {
|
||||
@ -85,6 +87,7 @@ const createServer = (options) => {
|
||||
app.use(express.static('public'))
|
||||
app.use(bodyParser.json({ limit: '10mb' }))
|
||||
app.use(bodyParser.urlencoded({ limit: '10mb', extended: true }))
|
||||
app.use(graphqlUploadExpress());
|
||||
server.applyMiddleware({ app, path: '/' })
|
||||
const httpServer = http.createServer(app)
|
||||
server.installSubscriptionHandlers(httpServer)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user