Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Integration of graphql-upload to Nestjs.

NotificationsYou must be signed in to change notification settings

hugocruzlfc/graphql-upload-integration-nestjs-from-scratch

Repository files navigation

Nest Logo

A progressiveNode.js framework for building efficient and scalable server-side applications.

NPM VersionPackage LicenseNPM DownloadsCircleCICoverageDiscordBackers on Open CollectiveSponsors on Open CollectiveDonate usSupport usFollow us on Twitter

Description

  • 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.

Testing the implementation

  • 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

Apollo Federation

  • If you want to use Apollo Federation you can visit the guys fromProfusion.

About

Integration of graphql-upload to Nestjs.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp