我已完成以下示例:How to delete all google search history,并且某些连接断开。
我只能在浏览器中看到此错误:
GET http://localhost:8080/api/pedidos 404 (Not Found)
我唯一的修改是更改表以增加一列。
我的server.js
var express = require("express")
var bodyParser = require("body-parser")
var pedidos = require("./routes/pedidos")
var cors = require("cors")
var port = 3000
var app = express()
app.use(cors())
app.use(bodyParser.json())
app.use(bodyParser.urlencoded({ extended: false }))
app.use("/api", pedidos)
app.listen(port, function () {
console.log('Server started on port >>> ' + port)
})
我的dev webpack配置:
{{ 2}}}我的pedidos.js
module.exports = {
dev: {
// Paths
assetsSubDirectory: 'static',
assetsPublicPath: '/',
// Various Dev Server settings
host: 'localhost', // can be overwritten by process.env.HOST
port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
proxyTable: {
'/api': {
target: 'http://localhost:3000',
changeOrigin: true,
logLevel: 'debug'
}
},
autoOpenBrowser: false,
errorOverlay: true,
notifyOnErrors: true,
poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
}
答案 0 :(得分:1)
您是否重启了前端服务器,通过运行'yarn serve'重新启动了vue.config.js