Skip to content

Commit

Permalink
Merge pull request #16 from j4ys0n/request-limit
Browse files Browse the repository at this point in the history
use body parser
  • Loading branch information
j4ys0n authored Sep 25, 2024
2 parents 7d1c72a + 8adf483 commit ea4bffd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "llm-proxy",
"version": "1.4.1",
"version": "1.4.2",
"description": "Manages Nginx for reverse proxy to multiple LLMs, with TLS & Bearer Auth tokens",
"main": "dist/index.js",
"scripts": {
Expand Down
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 ea4bffd

Please sign in to comment.