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)

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章