I worked on it all afternoon and reinstalled it many times. I found that there was no dev-server.js file in the build folder of vue-cli.

clipboard.png
compared with online tutorials, there are two fewer files and one more picture. And a small number of dev-server.js files happen to simulate the background data, how to change now, how to simulate the local data operation?

Mar.04,2021

the answer is the same as the one on the first floor:
in the webpack.dev.conf.js file

//
const express = require('express')
const app = express()
var appData = require('../data.json')
var seller = appData.seller
var goods = appData.goods
var ratings = appData.ratings
var apiRoutes = express.Router()
app.use('/api', apiRoutes)

//devServer,
before(app) {
  app.get('/api/seller', (req, res) => {
    res.json({
      // json
      errno: 0,
      data: seller
    })
  }),
  app.get('/api/goods', (req, res) => {
    res.json({
      // json
      errno: 0,
      data: goods
    })
  }),
  app.get('/api/ratings', (req, res) => {
    res.json({
      // json
      errno: 0,
      data: ratings
    })
  })
}

that's fine


edit in the webpack.dev.conf.js file.

add the following to the devServer option

  manually build a single vue+node page (1)  

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b227a9-2a361.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b227a9-2a361.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?