initial commit

This commit is contained in:
dude
2026-09-01 18:33:56 +00:00
commit c24449ee0a
2761 changed files with 302737 additions and 0 deletions
@@ -0,0 +1,23 @@
const cors = require('cors')
const { ALLOWED_HEADERS, ALLOWED_METHODS, MAX_AGE } = require ('../constants');
const tusExtension = (extensions = []) => {
if (!extensions.length) {
return (req, res, next) => next()
}
return (req, res, next) => {
res.set('Tus-Extension', extensions.join(','))
next()
}
}
const corsPreflight = (extraMethods) => cors({
methods: [...ALLOWED_METHODS, ...extraMethods],
allowedHeaders: ALLOWED_HEADERS,
maxAge: MAX_AGE,
})
module.exports = (extensions, extraMethods = []) => ([
tusExtension(extensions),
corsPreflight(extraMethods),
])