update
parent
8b4da1c071
commit
7e0a66a4ad
|
|
@ -0,0 +1,18 @@
|
||||||
|
# 使用官方 Node 镜像
|
||||||
|
FROM node:18
|
||||||
|
|
||||||
|
# 设置容器内工作目录
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# 拷贝依赖清单
|
||||||
|
COPY package*.json ./
|
||||||
|
|
||||||
|
# 安装依赖
|
||||||
|
RUN npm install
|
||||||
|
|
||||||
|
# 拷贝项目文件
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# 启动服务(默认端口为 3000)
|
||||||
|
EXPOSE 3000
|
||||||
|
CMD ["node", "server.js"]
|
||||||
|
|
@ -7,12 +7,76 @@
|
||||||
"msg": "mock success",
|
"msg": "mock success",
|
||||||
"users|5": [
|
"users|5": [
|
||||||
{
|
{
|
||||||
"id|+1": 1,
|
"id|+1": 6,
|
||||||
"name": "@cname",
|
"name": "@cname",
|
||||||
"age": "@integer(20,40)",
|
"age": "@integer(20,40)",
|
||||||
"email": "@email"
|
"email": "@email"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "GET",
|
||||||
|
"path": "/api/notice/list",
|
||||||
|
"response": {
|
||||||
|
"list|3": [
|
||||||
|
{
|
||||||
|
"id|+1": 3000,
|
||||||
|
"title": "@ctitle(10, 20)",
|
||||||
|
"content": "@cparagraph(2, 4)",
|
||||||
|
"author": "@cname",
|
||||||
|
"publishDate": "@date"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "GET",
|
||||||
|
"path": "/api/mall/recommend",
|
||||||
|
"response": {
|
||||||
|
"products|4": [
|
||||||
|
{
|
||||||
|
"id|+1": 1001,
|
||||||
|
"name": "@pick(['老年精纺防尿湿纸尿裤 医用护理','防摔防滑地垫 卫生间适老化改造专用','多功能床边扶手 起夜支撑辅助器','老人专用加厚棉拖鞋'])",
|
||||||
|
"price": "@float(39, 9999, 2, 2)",
|
||||||
|
"image": "@image('200x200', '#f4f4f4', '商品图')",
|
||||||
|
"soldCount": "@natural(50, 999)"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "GET",
|
||||||
|
"path": "/api/mall/category/list",
|
||||||
|
"response": {
|
||||||
|
"categories": [
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"name": "推荐",
|
||||||
|
"icon": "✨",
|
||||||
|
"description": "系统精选热销好物"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 2,
|
||||||
|
"name": "居家安全",
|
||||||
|
"icon": "🪑",
|
||||||
|
"description": "适老化家具与防护设施"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 3,
|
||||||
|
"name": "出行助理",
|
||||||
|
"icon": "🧳",
|
||||||
|
"description": "轮椅、手杖、出行辅助工具"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 4,
|
||||||
|
"name": "洗护用品",
|
||||||
|
"icon": "🧼",
|
||||||
|
"description": "护理垫、洗护、日常消毒"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
]
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ const swaggerDefinition = {
|
||||||
version: '1.0.0',
|
version: '1.0.0',
|
||||||
description: 'Dynamically registered mock APIs'
|
description: 'Dynamically registered mock APIs'
|
||||||
},
|
},
|
||||||
servers: [{ url: `http://localhost:${PORT}`, description: 'Local server' }]
|
servers: [{ url: `http://192.168.100.138:${PORT}`, description: 'Local server' }]
|
||||||
};
|
};
|
||||||
|
|
||||||
function buildSwaggerSpecFromMocks(configs) {
|
function buildSwaggerSpecFromMocks(configs) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue