I have this error, i don’t know where to put the return not to have this issue : TypeError: server.start_mockserver is not a function


Here is the code, please help.

const server = require(‘mockserver’);

const client = require(‘mockserver-client’).mockServerClient;

const port = 8080;

server
    .start_mockserver({serverPort: port,verbose: true})
    .then(
        function () {
            
            client("localhost", 8080).mockAnyResponse(
                {
                    'httpRequest': {

                        'path': '/api/v1/me'
                    },

                    'httpResponse' : {

                        'statusCode': 200,

                        'body': JSON.stringify({
                            "id": "037ee455-66d0-40f9-8269-3eb75f5e0066",
                            "entityId": "8888c0e4-26a2-4d70-8c4b-defdda33df79",
                            "entityImage": "ZARA_Lanzarote.png",
                            "lastUpdate": "2021-01-30T08:30:00Z"
                          }),
                        'delay' : {
                              'timeUnit' : 'MILISECONDS',
                              'value ' : 100
                          }
                    } 
                }
            ); 
        }
    )

Source: JavaSript – Stack Overflow

October 17, 2021
Category : News
Tags: javascript | mocking | node.js

Leave a Reply

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

Sitemap | Terms | Privacy | Cookies | Advertising

Senior Software Developer

Creator of @LzoMedia I am a backend software developer based in London who likes beautiful code and has an adherence to standards & love's open-source.