增加项目一般信息接口

master
pan 4 years ago
parent 2c3183b326
commit 7fcdbadb84
  1. 3
      app.js
  2. 27
      routes/project/info.js

@ -10,6 +10,7 @@ var mainRouter=require('./routes/main/main')
var projectRouter=require('./routes/main/project')
var dataRouter=require('./routes/main/data')
var projectDetailRouter=require('./routes/project/project')
var infoRouter=require('./routes/project/info')
const server = require("inspector");
var app = express();
@ -31,7 +32,7 @@ app.use(cors({
app.use('/', indexRouter);
app.use('/api/account',accountRouter)
app.use('/api/main',mainRouter,projectRouter,dataRouter)
app.use('/api/project',projectDetailRouter)
app.use('/api/project',projectDetailRouter,infoRouter)
// catch 404 and forward to error handler
app.use(function(req, res, next) {

@ -2,7 +2,32 @@ var express = require('express');
var router = express.Router();
var mock = require('../../public/javascripts/mock')
var Mock = require("mockjs")
var multipart = require('connect-multiparty');
var multipartMiddleware = multipart();
var moment = require("moment")
var util=require("../../public/javascripts/util")
//获取一般信息
router.get('/info', function (req, res, next) {
var data={
...mock.ok('成功获取项目一般信息')
,...{
body: {
companyName: Mock.Random.name(),
device: Mock.Random.name(),
unit: Mock.Random.name(),
projectNumber: Mock.Random.guid(),
startDate: Mock.Random.date(),
endDate: Mock.Random.date(),
analyticalMethod: Mock.Random.name(),
note: Mock.Random.name()
}
}}
res.json(data)
})
//保存一般信息
router.post('/info', multipartMiddleware,function (req, res, next) {
res.json(mock.ok(`数据自动保存成功,最后更新时间:${moment().format(util.dateFormat)}`))
})
module.exports = router
Loading…
Cancel
Save