gpt-4o-mini-2024-07-18· OpenAI
WildChat-4.8M (AI2)
Untitled conversation
- User
{description:Set up an Express server to listen on port 4000., Implement rate limiting using the 'express-rate-limit' package., Use 'helmet' for security headers., Enable CORS for universal access using the 'cors' package., Implement error handling middleware for routing errors. }
Analyse above object generate source code for description and send response as only a json_object {"name": "prompt_name", "schema": { "type": "string", "code":"genarted code" } }
- Assistant
{ "name": "Express Server Setup", "schema": { "type": "string", "code": "const express = require('express');\nconst rateLimit = require('express-rate-limit');\nconst helmet = require('helmet');\nconst cors = require('cors');\n\nconst app = express();\nconst PORT = 4000;\n\n// Set security headers\napp.use(helmet());\n\n// Enable CORS\napp.use(cors());\n\n// Rate limiting middleware\nconst limiter = rateLimit({\n windowMs: 15 * 60 * 1000, // 15 minutes\n max: 100 // limit each IP to 100 requests per windowMs\n});\napp.use(limiter);\n\n// Basic route\napp.get('/', (req, res) => {\n res.send('Hello, world!');\n});\n\n// Error handling middleware\napp.use((err, req, res, next) => {\n console.error(err.stack);\n res.status(500).json({ message: 'Something went wrong!' });\n});\n\napp.listen(PORT, () => {\n console.log(`Server is running on http://localhost:${PORT}`);\n});" } }
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.