Comments (3)
@phpb-com yes, there is api/src/mutations/getUploadURL.ts
and api/src/mutations/saveUpload.ts
on the API side. All you have to do on the client is to request "upload URL", send the file(s) via HTTP PUT to that URL, then send "uploaded file URL" to the saveUpload()
API mutation (which copies the file over from a temporary upload bucket location to a permanent place based on the linked content type (user photo, blog post pictures, etc.). As was described here.
from graphql-starter-kit.
Yep, it will be added soon. It would look like an API endpoint that generates upload URL (to Google Storage Bucket or Amazon S3). The client app would request that URL and upload file(s) directly to cloud storage using HTTP PUT
request.
mutation {
getUploadURL(filename: "hello-world.jpg", ...)
}
await fetch(uploadURL, { method: "PUT", body: file });
Each uploaded file needs to have a unique URL (e.g. by prefixing it with file ID) so it can be permanently cached at the CDN level. And then can be requested directly from google storage by client app(s). For example:
https://s.example.com/nv4fzx/hello-world.jpg
Where s.example.com
is a CDN endpoint (CNAME) pointing to gs://s.example.com
GCS bucket, and nv4fzx
is a unique file ID.
Also, it can be complemented with yet another cloud function that can be used to transform uploaded images via URL parameters, similarly to Cloudinary:
https://i.example.com/w_80,h_60,c_fill/nv4fzx/hello-world.jpg
Files
References
https://googleapis.dev/nodejs/storage/latest/File.html#generateSignedPostPolicyV4
https://cloud.google.com/functions/docs/tutorials/imagemagick
https://zelark.github.io/nano-id-cc/
P.S.: Join our Discord channel to discuss this feature https://discord.com/invite/bSsv7XM
from graphql-starter-kit.
Any update on this? Thanks.
from graphql-starter-kit.
Related Issues (20)
- Adding controller/service layer for business logic HOT 3
- MongoDB instead of PostgreSQL HOT 1
- Where is the Passport.js implementation? HOT 1
- Dependabot can't resolve your JavaScript dependency files
- Dependabot can't resolve your JavaScript dependency files
- Dependabot can't resolve your JavaScript dependency files
- big int HOT 1
- SyntaxError: Unexpected token = HOT 2
- Missing quotation marks in setup.js HOT 2
- Feature Request: "New Feature Walkthrough"
- Add the flexibility of multiple roles HOT 1
- Bug with emails that have "." in them breaks username requirements
- README.md out of date - no "setup" script HOT 3
- Nightly build fails
- Account settings page does not update
- docker image for the repo HOT 1
- error while run yarn setup HOT 1
- Readme.md has not been updated. HOT 1
- app-deploy.js file does not exists
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphql-starter-kit.