SoFunction
Updated on 2025-04-07

Detailed explanation of vue express startup data service

I have learned about the combination of vue and express in the past two days. This article records the data service started by vue express.

Record the configuration

build->Configuration

var apiServer = express()
var bodyParser = require('body-parser')
(({ extended: true }))
(())
var apiRouter = ()
var fs = require('fs')
('/:apiName')
.all(function (req, res) {
 ('./', 'utf8', function (err, data) {
  if (err) throw err
  var data = (data)
  if (data[]) {
   (data[]) 
  }
  else {
   ('no such api name')
  }

 })
})

('/api', apiRouter);
(port + 1, function (err) {
 if (err) {
  (err)
  return
 }
 ('Listening at http://localhost:' + (port + 1) + '\n')
})

config->Configuration

 proxyTable: {
    '/api/':'http://localhost:8081/'
  },

The above is all the content of this article. I hope it will be helpful to everyone's study and I hope everyone will support me more.