Article From:
Question: — dev-server object

devServer: {
    clientLogLevel: 'warning',
    historyApiFallback: true,
    hot: true,
    host: process.env.HOST ||,
    port: process.env.PORT ||,
    overlay: ? {
      warnings: false,
      errors: true,
    } : false,
    quiet: true, // necessary for FriendlyErrorsPlugin
    watchOptions: {
    before(app) {
      app.get('/api/joke', function(req, res) {
        // The API address of the requestConst url =''Axios.get (URL, {Params: req.query}).Then ((response) => {Res.json (response)}).CaTCH ((error) => {Console.error (error)})})}}


created() {
    this.axios.get('/api/joke', {
        params: {
            appkey: 'appkey',
            pagenum: 1,
            pagesize: 20,
            sort: 'addtime'
    }).then((res) => {
    }).catch((err) => {

When running NPM run dev, report the following error

Params is no problem, because using proxyTable proxy can return data.
How can I solve this problem?

Answer 0:

A mistake step by step.
The wrong information is circulatory reference when serializing JSON. Where is JSON serialization used?
The whole file is oneres.json
So why is response a circular reference
Because Axios calls in the nodejs environment, it uses the HTTP module of nodejs instead of Ajax request.,The default response returned by the HTTP module is a very complex object that will be recycled to itself, similar to the window.window in the browser.

As long as it is changed tores.json(’s OK.

Answer 1:

I want to ask how do you configure the express and Axios introduced before devServer? Now I have some problems.

Leave a Reply

Your email address will not be published. Required fields are marked *