Files
mrfrys-node-server/src/modules/api/submodules/feedback.ts
T
2023-04-11 14:59:26 +02:00

41 lines
1.3 KiB
TypeScript

/* ----------------------------------------------------------------------------
Question Server
GitLab: <https://gitlab.com/MrFry/mrfrys-node-server>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
------------------------------------------------------------------------- */
import { Response } from 'express'
import utils from '../../../utils/utils'
import { Request, SubmoduleData } from '../../../types/basicTypes'
const uloadFiles = 'data/f'
function setup(data: SubmoduleData): void {
const { app } = data
app.route('/fosuploader').post(function (req: Request, res: Response) {
utils.uploadFile(req, uloadFiles).then(({ fileName }) => {
res.redirect('/f/' + fileName)
})
})
}
export default {
setup: setup,
}