gpt-4o-mini-2024-07-18· OpenAI
WildChat-4.8M (AI2)
Description: create a node.js server with port 400 user express and helmet and rate…
- User
Description: create a node.js server with port 400 user express and helmet and rate limitter, connect databse with local server
Generate source code based on the description above and respond in the following JSON format ONLY: ```json { "name": "prompt_name", "schema": { "type": "string", "code": "Generated code here" } } ``` IMPORTANT: - Ensure the JSON response is error-free. - Include no additional text or explanations. Respond with the JSON object only. - Assistant
{ "name": "node_server_setup", "schema": { "type": "string", "code": "const express = require('express');\nconst helmet = require('helmet');\nconst rateLimit = require('express-rate-limit');\nconst mongoose = require('mongoose');\n\nconst app = express();\nconst PORT = 400;\n\n// Middleware\napp.use(helmet());\n\n// Rate limiter\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// Connect to the database\nmongoose.connect('mongodb://localhost:27017/mydatabase', {\n useNewUrlParser: true,\n useUnifiedTopology: true,\n})\n.then(() => console.log('MongoDB connected'))\n.catch(err => console.error(err));\n\n// Basic route\napp.get('/', (req, res) => {\n res.send('Hello World!');\n});\n\n// Start the server\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.