2021-04-03 17:46:54 +00:00
|
|
|
import type { Application } from 'express'
|
|
|
|
import logger from 'morgan'
|
|
|
|
import express from 'express'
|
|
|
|
import cookieParser from 'cookie-parser'
|
|
|
|
import { WEBUI_DIR } from './helpers/paths'
|
|
|
|
|
|
|
|
export function registerMiddlewares(app: Application) {
|
2021-04-24 16:03:27 +00:00
|
|
|
if (process.env.NODE_ENV !== 'test') {
|
|
|
|
app.use(logger('dev'))
|
|
|
|
}
|
|
|
|
|
2021-04-03 17:46:54 +00:00
|
|
|
app.use(express.json())
|
|
|
|
app.use(express.urlencoded({ extended: false }))
|
|
|
|
app.use(cookieParser())
|
|
|
|
app.use(express.static(WEBUI_DIR))
|
|
|
|
}
|