The validateMetadata function referred to in this example code isn't defined!
**const {Server} = require('@tus/server')
// ...
const server = new Server({
// ..
async onUploadCreate(req, res, upload) {
const {ok, expected, received} = validateMetadata(upload)
if (!ok) {
const body = Expected "${expected}" in "Upload-Metadata" but received "${received}"
throw {status_code: 500, body} // if undefined, falls back to 500 with "Internal server error".
}
// We have to return the (modified) response.
return res
},
})**
The validateMetadata function referred to in this example code isn't defined!
**const {Server} = require('@tus/server') // ...
const server = new Server({ // .. async onUploadCreate(req, res, upload) { const {ok, expected, received} = validateMetadata(upload) if (!ok) { const body =
Expected "${expected}" in "Upload-Metadata" but received "${received}"
throw {status_code: 500, body} // if undefined, falls back to 500 with "Internal server error". } // We have to return the (modified) response. return res }, })**