Description: add a /admin router from adminRouter file const express =…
- User
Description: add a /admin router from adminRouter file
const express = require('express'); const helmet = require('helmet'); const rateLimit = require('express-rate-limit'); const mongoose = require('mongoose'); const userRouter = require('./src/router/userRouter'); const productRouter = require('./src/router/productRouter'); const cartRouter = require('./src/router/cartRouter'); const app = express(); require('./src/config/db')();
const PORT = 4000;
// Middleware app.use(helmet());
// Rate limiter const limiter = rateLimit({ windowMs: 15 * 60 * 1000, // 15 minutes max: 100 // limit each IP to 100 requests per windowMs }); app.use(limiter);
app.use(express.json()); // Connect to the database
// Basic route app.use('/user', userRouter); app.use('/product', productRouter); app.use('/cart', cartRouter);
// Start the server app.listen(PORT, () => { console.log(
Server is running on http://localhost:${PORT}); });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": "admin_router_integration", "schema": { "type": "string", "code": "const adminRouter = require('./src/router/adminRouter');\n\napp.use('/admin', adminRouter);" } }