【问题标题】:I am having a server running problem in Nodejs [closed]我在Nodejs中遇到服务器运行问题[关闭]
【发布时间】:2021-05-23 10:54:10
【问题描述】:

使用 Express js 运行我的项目时" 我收到一条错误消息,提示“我在 Nodejs 中遇到服务器运行问题。我该如何解决。

const router = require('express').Router()

// all product
router.get('/', (req, res) => {
  res.send('all product')
})

// get product
router.get('/:productID', (req, res) => {
  res.send(`$(req.params.productID) id ile gelen urun`)
})

router.post('/create', (req, res) => {
  res.send('product created')
})

router.patch('/:productID', (req, res) => {
  res.send(`$(req.params.productID) product update`)
})

router.delete('/:productID', (req, res) => {
  res.send(`$(req.params.productID) prdoduct delete`)
}) 

module.export = router

【问题讨论】:

  • 提供准确的错误信息,不要转述。
  • 在您提供有关错误消息的确切内容、错误出现的代码以及您需要帮助的更完整描述的更详细信息之前,我们无法为您提供帮助。您的问题正在累积接近票和反对票,因为对于任何人都无法帮助您来说还不够清楚。您需要提供更完整的问题描述,然后才能有人帮助您。

标签: node.js express


【解决方案1】:

使用module.exports = router 代替module.export = router

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-01-26
    • 1970-01-01
    • 2022-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-03-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多