002 nodejs express服务端POST/GET请求

一、GET请求

router.get('/paydone', function (req, res, next) {
  const payid = req.query.payid
  const paytype = req.query.type
  const price = req.query.price
  const reallyPrice = req.query.reallyPrice
  const param = req.query.param
  res.send({
    payid, paytype, price, reallyPrice, param
  })
})

二、POST请求

router.post('/', function (req, res, next) {
  console.log({
    res_code: '0',
    type: file.mimetype,
    originalname: file.originalname,
    size: file.size,
    path: file.path
  })
  res.send({ title: 'PrintPdf' });
});

三、使用子路由

var upload = require('./upload');

router.use('/PrintPdf', upload)

 

posted @ 2019-09-26 13:32  南风S  阅读(108)  评论(0)    收藏  举报