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

Refactor server to run in all (Node.js compatible) runtimes and meta frameworks #710

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .changeset/polite-bikes-train.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
"@tus/server": major
---

- Introduce `handleWeb(req: Request)` to integrate into meta frameworks
(such as Next.js, Nuxt, React Router, SvelteKit, etc) and other Node.js compatible runtime environments.
- All events and hooks now emit `Request`/`Response` instead of `http.IncomingMessage`/`http.ServerResponse`.
- The function version of the options `maxSize`, `generateUrl`, `getFileIdFromRequest`, `namingFunction`, `locker`
also now use `Request`/`Response`.
- Your `onUploadCreate` and `onUploadFinish` hooks no longer need to return the response object.
- If you want to change the metadata in `onUploadCreate` you can return `Promise<{ metadata: Record<string, string> }>`.
This will will internally merge the existing metadata with the new metadata.
- `onUploadFinish` can return `Promise<{ status_code?: number headers?: Record<string, string | number> body?: string }>`
5 changes: 4 additions & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@
"enabled": true
},
"files": {
"ignore": ["./**/dist/**/*"]
"ignore": [".git", "node_modules", "./**/dist/**/*"]
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"style": {
"noParameterAssign": "off"
},
"performance": {
"noDelete": "off"
}
}
},
Expand Down
21 changes: 19 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading