mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2026-04-28 03:07:38 +02:00
added / fixed some types
This commit is contained in:
@@ -19,9 +19,7 @@
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
// package requires
|
||||
import express from 'express'
|
||||
import bodyParser from 'body-parser'
|
||||
import busboy from 'connect-busboy'
|
||||
import express, { RequestHandler } from 'express'
|
||||
const app = express()
|
||||
|
||||
// other requires
|
||||
@@ -30,7 +28,7 @@ import { SetupData } from '../../server'
|
||||
import { ModuleType } from '../../types/basicTypes'
|
||||
|
||||
// stuff gotten from server.js
|
||||
let publicdirs = []
|
||||
let publicdirs: string[] = []
|
||||
let url = '' // http(s)//asd.basd
|
||||
|
||||
function GetApp(): ModuleType {
|
||||
@@ -40,39 +38,28 @@ function GetApp(): ModuleType {
|
||||
logger.Log(`Using public dir: ${pdir}`)
|
||||
app.use(express.static(pdir))
|
||||
})
|
||||
|
||||
app.use(express.json() as RequestHandler)
|
||||
app.use(
|
||||
busboy({
|
||||
limits: {
|
||||
fileSize: 10000 * 1024 * 1024,
|
||||
},
|
||||
})
|
||||
)
|
||||
app.use(bodyParser.json())
|
||||
app.use(
|
||||
bodyParser.urlencoded({
|
||||
express.urlencoded({
|
||||
limit: '5mb',
|
||||
extended: true,
|
||||
})
|
||||
)
|
||||
app.use(
|
||||
bodyParser.json({
|
||||
limit: '5mb',
|
||||
})
|
||||
}) as RequestHandler
|
||||
)
|
||||
|
||||
// --------------------------------------------------------------
|
||||
|
||||
app.get('/', function(req, res) {
|
||||
app.get('/', function (_req, res) {
|
||||
res.render('main', {
|
||||
siteurl: url,
|
||||
})
|
||||
})
|
||||
|
||||
app.get('*', function(req, res) {
|
||||
app.get('*', function (_req, res) {
|
||||
res.status(404).render('404')
|
||||
})
|
||||
|
||||
app.post('*', function(req, res) {
|
||||
app.post('*', function (_req, res) {
|
||||
res.status(404).render('404')
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user