mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
Added user file vote api
This commit is contained in:
parent
1a7b787eed
commit
0da1dab95d
2 changed files with 166 additions and 59 deletions
|
@ -54,6 +54,8 @@ function GetApp(): ModuleType {
|
|||
domain = domain.join('.') // "frylabs.net"
|
||||
logger.DebugLog(`Cookie domain: ${domain}`, 'cookie', 1)
|
||||
|
||||
// -------------------------------------------------------------------------------------------
|
||||
|
||||
app.use(
|
||||
bodyParser.urlencoded({
|
||||
limit: '10mb',
|
||||
|
@ -81,15 +83,7 @@ function GetApp(): ModuleType {
|
|||
],
|
||||
})
|
||||
)
|
||||
publicdirs.forEach((pdir) => {
|
||||
logger.Log(`Using public dir: ${pdir}`)
|
||||
app.use(express.static(pdir))
|
||||
})
|
||||
app.use(
|
||||
fileUpload({
|
||||
limits: { fileSize: 50 * 1024 * 1024 },
|
||||
})
|
||||
)
|
||||
// -------------------------------------------------------------------------------------------
|
||||
|
||||
let rootRedirectURL = ''
|
||||
|
||||
|
@ -128,7 +122,7 @@ function GetApp(): ModuleType {
|
|||
|
||||
// --------------------------------------------------------------
|
||||
|
||||
app.get('/', function(req: Request, res: any) {
|
||||
app.get('/', function (req: Request, res: any) {
|
||||
logger.LogReq(req)
|
||||
if (reloadRootRedirectURL) {
|
||||
res.redirect(rootRedirectURL)
|
||||
|
@ -143,11 +137,23 @@ function GetApp(): ModuleType {
|
|||
|
||||
// -------------------------------------------------------------------------------------------
|
||||
|
||||
app.get('*', function(req: Request, res: any) {
|
||||
publicdirs.forEach((pdir) => {
|
||||
logger.Log(`Using public dir: ${pdir}`)
|
||||
app.use(express.static(pdir))
|
||||
})
|
||||
app.use(
|
||||
fileUpload({
|
||||
limits: { fileSize: 50 * 1024 * 1024 },
|
||||
})
|
||||
)
|
||||
|
||||
// -------------------------------------------------------------------------------------------
|
||||
|
||||
app.get('*', function (req: Request, res: any) {
|
||||
res.status(404).render('404')
|
||||
})
|
||||
|
||||
app.post('*', function(req: Request, res: any) {
|
||||
app.post('*', function (req: Request, res: any) {
|
||||
res.status(404).render('404')
|
||||
})
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue