Assets API and new folder structure

Hi guys,

I am trying to follow the new recommended 1.3 folder structure and so don’t have one big client or server folder anymore, but instead a bunch of “modules”, under each of which there are client and server folders scoped to this one module/feature.

So now I want to load a static file from the server (e.g. myAwesomeQueryString.graphql), and so tried to follow the API documention for Assets.getText(), and thought I’d put it in private\myAwesomeQueryString.graphql.
However, this “private” folder is not in my app root, but instead within my module (i.e. some subfolder of the app).

And Meteor can’t seem to find it now, when I call

Assets.getText('myAwesomeQueryString.graphql');

I get Error: Unknown asset: myAwesomeQueryString.graphql now.

The API documentation tells me, the path it looks for is relative to the “private” folder, but of course there may be a bunch of them now, if I have one per module.
I wouldn’t want to have to pull them out into one root-level “private” folder again, because that breaks the recommended modularity of Meteor since 1.3.

Thoughts?

Edit: Better to show an example:

Both getText and getBinary work relative to the root /private directory only:

You could consider create a matching hierarchy in your /private subdirectory though, like:

/private
  /bunits
  /forecasts
    forecasts.graphql

This will at least help keep things somewhat organized.

1 Like

Yea, I was hoping to avoid that, since I wanted to keep each module as self-contained as possible.
But there we are.

Thanks for checking, @hwillson!