Skip to content
This repository has been archived by the owner on Oct 11, 2022. It is now read-only.

How to serve a static file with simple-rest #148

Open
morphogencc opened this issue Dec 29, 2017 · 0 comments
Open

How to serve a static file with simple-rest #148

morphogencc opened this issue Dec 29, 2017 · 0 comments

Comments

@morphogencc
Copy link

By defining a Meteor method, I can return a JSON Object as such:

Meteor.method("returnJsonObject", function() {
    return { "test" : "this is a test" }
});

If I send a GET request to http://localhost:3000/methods/returnJsonObject, this returns plain text just as I expect.

If I want a browser to be redirected here and automatically download this text as a file, such as "download.json", then I need to be able to update the response headers to indicate this is a file.

Is it possible to access the response headers in order to serve a file like this? I checked the unit tests and couldn't find an example...

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

No branches or pull requests

1 participant