Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility with Apollo-server. #161

Open
cbilotta opened this issue May 25, 2017 · 5 comments
Open

Compatibility with Apollo-server. #161

cbilotta opened this issue May 25, 2017 · 5 comments
Labels

Comments

@cbilotta
Copy link

Hello,

I have a Graphql server (ApolloServer) separated from my main app.
I handle auth using this package : https://github.com/orionsoft/meteor-apollo-accounts

So my quick questions are :

How can I upload via myCollection.resumable.upload() to another server (the Apollo server) ?
Is it possible to get auth working with the package I mentioned ?

Thanks!

@vsivsi
Copy link
Owner

vsivsi commented May 25, 2017

Hi, I don't know anything about ApolloServer. Currently file-collection only supports uploading to the Meteor server hosting the file-collection instance. The backing mongoDB can be anywhere.

Built-in authorization is only currently handled using Meteor account tokens, but file-collection is very flexible about handling metadata and determining which Requests/URIs map successfully to a file. So you could almost certainly write code to use another authentication scheme such as whatever ApolloServer does. But file-collection is agnostic about that and won't do it "out-of-the-box"

@cbilotta
Copy link
Author

Ok I get it,
So I just have to figure out how to send the resumable stuff to my other server ?
Do I understand well what does myCollection.resumable.upload does :

  1. Create a file on the server and get the ID or whatever back
  2. Upload the file chunk by chunk using resumable APIs

Is that it ?

I'm sorry if I'm asking stupid questions but I have trouble navigation the source code due to the fact that I know nothing about coffee script.

If I'm successful I'll happily try to glue together a starter kit :)

@vsivsi
Copy link
Owner

vsivsi commented May 25, 2017

So the main thing to know is that file-collection stores the file inside MongoDB using gridFS. That is the only place the files exist. The resumable.js upload chunks map 1:1 with gridFS chunks.

If you need files on the server filesystem (not in the database) then file-collection probably isn't for you. Although you could rig together something to automatically export files back out of the DB, that is probably overly complicated.

Unfortunately, I'm just about drop off of the internet for nearly a month, so I'm afraid I can't help you more now.

@cbilotta
Copy link
Author

I knew about that 😃

I want to keep all the GridFS and resumable goodness that's why I'm trying to find a workaround!

I'll try to figure out how to upload to another server and mess around with the auth methods a bit.

Have a nice vacation & thanks for this great library!

@vsivsi
Copy link
Owner

vsivsi commented May 25, 2017

Good luck!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants