Files
speckle-server/packages/server/modules/core/helpers/server.ts
T
2024-02-13 15:08:48 +02:00

11 lines
321 B
TypeScript

import type { IncomingMessage } from 'http'
import type express from 'express'
import { get } from 'lodash'
export const getRequestPath = (req: IncomingMessage | express.Request) => {
const path = (get(req, 'originalUrl') || get(req, 'url') || '').split(
'?'
)[0] as string
return path?.length ? path : null
}