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

Help with file redirect responses #106

Open
jyecusch opened this issue Mar 4, 2022 · 0 comments
Open

Help with file redirect responses #106

jyecusch opened this issue Mar 4, 2022 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@jyecusch
Copy link
Member

jyecusch commented Mar 4, 2022

When responding to API requests with a file a convenience method would be nice that sets the appropriate response headers for a redirect and returns the pre-signed read URL.

Dev experience should be something like this:

import { api, bucket } from "@nitric/sdk";

const files = bucket('files').for('reading');
const fileApi = api('file-api');

fileApi.get("/files/:filename", async (ctx) => {
  const { filename } = ctx.req.params;
  const file = files.file(filename)
  ctx.res.file(file);
});
@jyecusch jyecusch added the enhancement New feature or request label Mar 4, 2022
@raksiv raksiv added the good first issue Good for newcomers label Sep 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants