Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions examples/express-benchmark-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,8 @@ app.get('/mixed', (req, res) => {
}
})

// Batch endpoint - runs multiple operations of the same type
app.get('/batch/:type/:count?', (req, res) => {
// Helper function for batch processing
function handleBatchRequest (req, res) {
const { type, count = 5 } = req.params
const batchCount = Math.min(Math.max(parseInt(count), 1), 20) // Limit between 1-20

Expand Down Expand Up @@ -350,7 +350,13 @@ app.get('/batch/:type/:count?', (req, res) => {
timestamp: new Date().toISOString()
})
}
})
}

// Batch endpoint - runs multiple operations of the same type (with count)
app.get('/batch/:type/:count', handleBatchRequest)

// Batch endpoint - runs multiple operations of the same type (default count)
app.get('/batch/:type', handleBatchRequest)

// Root endpoint - provides API documentation
app.get('/', (req, res) => {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"compression": "^1.7.4",
"cors": "^2.8.5",
"eslint": "^9.0.0",
"express": "^4.19.2",
"express": "^5.0.0",
"helmet": "^8.0.0",
"light-my-request": "^6.6.0",
"morgan": "^1.10.0",
Expand Down
Loading