- Notifications
You must be signed in to change notification settings - Fork0
hugocruzlfc/graphql-upload-integration-nestjs-from-scratch
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
A progressiveNode.js framework for building efficient and scalable server-side applications.
This project is about compatibility and being able to addgraphql-upload toNest.js
The current version of graphql-upload, 5/09/2024, is 16.0.2. which has caused compatibility problems with Nest.js, commonjs modules and .mjs files.
-If you decide to use a recent version you should use it like this in the main file of your project:
asyncfunctionbootstrap(){constapp=awaitNestFactory.create(AppModule);constconfigService=app.get(ConfigService);// ...const{default:graphqlUploadExpress}=awaitimport('graphql-upload/graphqlUploadExpress.mjs');app.use(graphqlUploadExpress({maxFileSize:10000000,maxFiles:10}));// ...app.useGlobalPipes(newValidationPipe());awaitapp.listen(configService.get<number>('port'));}
- Personally, I prefer to use the version 13.0.0 and "@types/graphql-upload": "8.0.12", which is the one that I have used in this project.
- You can try using the following curl:
curl localhost:3000/graphql \ -H"x-apollo-operation-name: upload_file" \ -F operations='{ "query": "mutation ($file: Upload!) { upload_file(file: $file) }", "variables": { "file": null } }' \ -F map='{ "0": ["variables.file"] }' \ -F 0=@Product2.jpg
- If you want to use Apollo Federation you can visit the guys fromProfusion.
About
Integration of graphql-upload to Nestjs.
Topics
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
No releases published
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.