Skip to content

Commit

Permalink
use body parser
Browse files Browse the repository at this point in the history
  • Loading branch information
j4ys0n committed Sep 25, 2024
1 parent 7c7998f commit 9494c0d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,19 @@ import { LLMController } from './controllers/llm'
import { tokenMiddleware } from './utils/auth'
import { AuthController } from './controllers/auth'
import { log } from './utils/general'
import bodyParser from 'body-parser'

dotenv.config()

const app = express()
const port = process.env.PORT || 8080
const targetUrls = (process.env.TARGET_URLS || 'http://example.com').split(',').map((url) => url.trim())

app.use(express.json())

// app.use(express.json())
app.use(bodyParser.json())
const payloadLimit = process.env.PAYLOAD_LIMIT || '1mb'
app.use(express.json({ limit: payloadLimit }))
app.use(express.urlencoded({ limit: payloadLimit, extended: true }))
app.use(bodyParser.json({ limit: payloadLimit }))
app.use(bodyParser.urlencoded({ extended: false, limit: payloadLimit }))
log('info', `Payload limit is: ${payloadLimit}`)

// Express routes
Expand Down

0 comments on commit 9494c0d

Please sign in to comment.