diff --git a/bin/www b/bin/www index 81cb39b43c39a606b8ac0633a2747dc3807855e8..8e8187c1caed85ae252a9800184eece7a3127d85 100755 --- a/bin/www +++ b/bin/www @@ -12,7 +12,7 @@ var http = require('http'); * Get port from environment and store in Express. */ -var port = normalizePort(process.env.PORT || '3000'); +var port = normalizePort(process.env.PORT || '3088'); app.set('port', port); /** diff --git a/model/kys.js b/model/kys.js index c5c5150b8f8ebccdffdd05316d2791f67de47cd1..25a6ccb4a6cf5da65b47fcf0601d4157c8a1cf20 100644 --- a/model/kys.js +++ b/model/kys.js @@ -19,8 +19,13 @@ const menuSchema = new Schema({ }] }) +const testSchema = new Schema({ + name:String +}) + let menuModel = mongoose.model('menu', menuSchema,'menu') +let testModel = mongoose.model('test', testSchema,'test') module.exports={ - menuModel + menuModel,testModel } \ No newline at end of file diff --git a/routes/kys.js b/routes/kys.js index 9264798ce6d6c4d525cf5a933f1e75976e1b34f7..290e455d2b0a2962912d07544404405e31b23089 100644 --- a/routes/kys.js +++ b/routes/kys.js @@ -1,6 +1,24 @@ var express = require('express'); var router = express.Router(); +var {menuModel,testModel} =require('../model/kys') +router.post('/add',(req,res)=>{ + testModel.create(req.body) + res.send({ + code:200, + msg:'添加成功' + }) +}) +router.get('/list',async(req,res)=>{ + console.log(req.query,'ttt'); +let {name}=req.query +let data=await testModel.find({name}) +res.send({ + status:0, + message:'添加成功', + data +}) +}) module.exports = router;