One place for hosting & domains

      Services

      INAP Executive Spotlight: Mary Jane Horne, SVP, Global Network Services


      In the INAP Executive Spotlight series, we interview senior leaders across the organization, hearing candid reflections about their careers, the mentors who shaped them and big lessons learned along the way.Mary Jane Horne headshot black and white

      Next in the series is Mary Jane Horne, SVP of Global Network Services. With over 25 years of network and operations experience, Horne currently oversees INAP’s network engineering, carrier management, and global support teams, and is responsible for these activities across INAP’s worldwide footprint.

      Horne shares the lessons she’s learned throughout her career, working in the technology, media and telecommunications industries in the U.S. and abroad. Read on to learn what she loves about her role in tech, and the advice that she has for those looking to progress along their career path.

      The interview has been lightly edited for clarity and length.

      How did you get started in network engineering? What inspired you to pursue it?

      Growing up, my dad was an engineer. I started out in college as a computer science major, but switched after my first year to engineering. I spent five years at Northeastern University in Boston studying electrical and computer engineering, and I worked for the federal government while in school.

      After graduation, I went to work for the phone company, and my first job was as a central office design engineer. I was given some of the best advice of my career by my first manager, which was to move around as much as I could at the “doer “level, to figure out how the company worked. I had 10 jobs in the 13 and a half years I worked there, with a variety of roles in field engineering, technical sales support, customer service and corporate development. I learned how interdependent everyone was, and how best to improve important processes.

      After deciding to change companies to a small fiber start up, I realized the most important part of any company is its foundation. In the roles I held there, we created the strategy for the company, built out the network, thought out of the box for customer solutions and drove sales from $100k in year one to $64.5M in year five. Here is where I truly embraced the role network plays in driving the success of the company.

      Can you tell us more about your work with the global network services team? What are some challenges with that part of the business?

      Our global network strategy started by going from metro to metro and grooming the network components (both fiber and lit services) which eliminated of a lot of unnecessary costs in running the network. We also lit an express 100-gig ring between 3 key data center locations (Dallas/NY/San Jose) to carry more of our own traffic on-net. We have, since the completion of these first 2 initiatives, been upgrading a majority of the US and trans-Atlantic backbones to 100gig as well, to provide much needed additional capacity. We’re deploying new state of the art technology from Ciena on the fiber and bandwidth we are purchasing, allowing us to provide scalability and redundancy, while giving us the opportunity to develop new products in the future. When all is said and done with these three initiatives, the network operating expenses are flat with what they were before, however, our capacity will be three times what it was in the old network.

      We also have the software side of the network. We have CDN, Performance IP®, Managed DNS, as well as other in-house tools supported by the team. They are continuously evaluating where we need to take these products in order to stay competitive, which may include partnering and white labeling. How do we get these products launched across this network that we are deploying and upgrading? Global network services is not just a foundation, but it’s also the product and services that ride across the network. We have infrastructure evolution, as well as product evolution, and that’s where I focus with the team.

      What do you love about your role in tech?

      Learning new things and trying new things is part of who I am. Because tech is ever changing, it’s always been very exciting for me. I think as tech has evolved, some people have fallen off the bandwagon since they don’t keep up with the latest and greatest trends.

      In tech, you must be a person who looks to the future. I look at what’s coming up, not just how I need to design a network for today, and what the customers need today, but what I need three years from now. What should I consider now to prepare for any changes that might come down the road? That’s one of the things that I’ve always been attracted to in the tech industry— looking far enough ahead to say, “I need to do this, but I don’t want to be shortsighted and do it the cheap way just to get done with today. I want to look at how to do it the best way, so we are ready for the future, and we can then move forward faster.” Tech gives me exciting opportunities to do that.

      Of the qualities you possess, which do you think has been the greatest influence on your success?

      The ability to try anything and rise to challenges, even when I have no idea what I’m doing. I credit my boss, Pete Aquino [INAP CEO], for challenging me over the course of our working relationship. He would say, “I have a need for X.” And I’d say, “I’ve never done that before.” He’d respond, “That’s fine. I know you’ll figure it out.”

      I have learned so much because I did things that I never would have done anywhere else in my career, because somebody trusted me to figure it out. The only thing you need to say to me is it’s impossible, or everyone else who tried couldn’t do it, because now I’m sure I’m going to get it done. I love a challenge. I think that’s driven me through my career.

      Who are some of the people that have mentored you in your career?

      Some of the best advice I’ve ever been given came from another other female leader in the industry. When I wanted to make that jump from being a manager to the next level, my boss at the time was a female director, and that was considered quite the accomplishment (back then) at a phone company. I said to her, “’I’m ready, I’m looking to move up. I’m really excited.” She gave me the second best piece of advice I’ve ever been given: Just because you are really good at what you do today, does not mean you ready for the next level. She pointed out, in order to be considered for the next level, you need to continuously demonstrate leadership qualities and focus on how you embrace and lead change.

      That was an eye opening, great piece of advice. That’s when I made some drastic changes and left the big stable environment to go to a risky startup, where you have to lead every day to be successful.

      If you had to pick a piece of advice that you’d give to someone pursuing IT or network engineering as a career path, what would that be?

      I just approved some training for people who want to learn more. Don’t be afraid to ask for that. Always stay current, always stay hungry, always learn as much as you can, and learn across platforms. It’ll make you more valuable.

      Also, tell your boss what you need and what you’re interested in. You must have open communication with your manager. We are not mind readers, so talk about what your plans might be, or ask for help in developing them. We are the ones who have to drive our own careers.

      Are there any other big lessons you’ve learned in your career that you want to share?

      I learned to take a step back and think about things in the big picture, instead of just what I’m doing today. What I decide to do today could affect what other people will be doing well into the future, especially in technology. Ask yourself, am I really making the right choice, or do I need to evaluate other options?

      I also believe we should cross-train people. At a minimum, I think we should have people sit in somebody else’s job for a week or two, and swap chairs. It gives employees appreciation for other roles and responsibilities that they may not truly understand or have misjudged. It also may help folks develop a path to pursue other roles in the future.

      I was lucky enough in my career to be able to move from department to department, so I could get a better view of how a company worked. You can’t always do that in smaller companies, but I think those are valuable lessons to learn. We should spend more time educating one another on how things work at INAP.

      Laura Vietmeyer


      READ MORE



      Source link

      How To Mock Services Using Mountebank and Node.js


      The author selected the Open Internet/Free Speech Fund to receive a donation as part of the Write for DOnations program.

      Introduction

      In complex service-oriented architectures (SOA), programs often need to call multiple services to run through a given workflow. This is fine once everything is in place, but if the code you are working on requires a service that is still in development, you can be stuck waiting for other teams to finish their work before beginning yours. Additionally, for testing purposes you may need to interact with external vendor services, like a weather API or a record-keeping system. Vendors usually don’t give you as many environments as you need, and often don’t make it easy to control test data on their systems. In these situations, unfinished services and services outside of your control can make code testing frustrating.

      The solution to all of these problems is to create a service mock. A service mock is code that simulates the service that you would use in the final product, but is lighter weight, less complex, and easier to control than the actual service you would use in production. You can set a mock service to return a default response or specific test data, then run the software you’re interested in testing as if the dependent service were really there. Because of this, having a flexible way to mock services can make your workflow faster and more efficient.

      In an enterprise setting, making mock services is sometimes called service virtualization. Service virtualization is often associated with expensive enterprise tools, but you don’t need an expensive tool to mock a service. Mountebank is a free and open source service-mocking tool that you can use to mock HTTP services, including REST and SOAP services. You can also use it to mock SMTP or TCP requests.

      In this guide, you will build two flexible service-mocking applications using Node.js and Mountebank. Both of the mock services will listen to a specific port for REST requests in HTTP. In addition to this simple mocking behavior, the service will also retrieve mock data from a comma-separated values (CSV) file. After this tutorial, you’ll be able to mock all kinds of service behavior so you can more easily develop and test your applications.

      Prerequisites

      To follow this tutorial, you will need the following:

      Step 1 — Starting a Node.js Application

      In this step, you are going to create a basic Node.js application that will serve as the base of your Mountebank instance and the mock services you will create in later steps.

      Note: Mountebank can be used as a standalone application by installing it globally using the command npm install -g mountebank. You can then run it with the mb command and add mocks using REST requests.

      While this is the fastest way to get Mountebank up and running, building the Mountebank application yourself allows you to run a set of predefined mocks when the app starts up, which you can then store in source control and share with your team. This tutorial will build the Mountebank application manually to take advantage of this.

      First, create a new directory to put your application in. You can name it whatever you want, but in this tutorial we’ll name it app:

      Move into your newly created directory with the following command:

      To start a new Node.js application, run npm init and fill out the prompts:

      The data from these prompts will be used to fill out your package.json file, which describes what your application is, what packages it relies on, and what different scripts it uses. In Node.js applications, scripts define commands that build, run, and test your application. You can go with the defaults for the prompts or fill in your package name, version number, etc.

      After you finish this command, you'll have a basic Node.js application, including the package.json file.

      Now install the Mountebank npm package using the following:

      • npm install -save mountebank

      This command grabs the Mountebank package and installs it to your application. Make sure to use the -save flag in order to update your package.json file with Mountebank as a dependency.

      Next, add a start script to your package.json that runs the command node src/index.js. This script defines the entry point of your app as index.js, which you'll create in a later step.

      Open up package.json in a text editor. You can use whatever text editor you want, but this tutorial will use nano.

      Navigate to the "scripts" section and add the line "start": "node src/index.js". This will add a start command to run your application.

      Your package.json file should look similar to this, depending on how you filled in the initial prompts:

      app/package.json

      {
        "name": "diy-service-virtualization",
        "version": "1.0.0",
        "description": "An application to mock services.",
        "main": "index.js",
        "scripts": {
          "start": "node src/index.js"
        },
        "author": "Dustin Ewers",
        "license": "MIT",
        "dependencies": {
          "mountebank": "^2.0.0"
        }
      }
      

      You now have the base for your Mountebank application, which you built by creating your app, installing Mountebank, and adding a start script. Next, you'll add a settings file to store application-specific settings.

      Step 2 — Creating a Settings File

      In this step, you will create a settings file that determines which ports the Mountebank instance and the two mock services will listen to.

      Each time you run an instance of Mountebank or a mock service, you will need to specify what network port that service will run on (e.g., http://localhost:5000/). By putting these in a settings file, the other parts of your application will be able to import these settings whenever they need to know the port number for the services and the Mountebank instance. While you could directly code these into your application as constants, changing the settings later will be easier if you store them in a file. This way, you will only have to change the values in one place.

      Begin by making a directory called src from your app directory:

      Navigate to the folder you just created:

      Create a file called settings.js and open it in your text editor:

      Next, add settings for the ports for the main Mountebank instance and the two mock services you'll create later:

      app/src/settings.js

      module.exports = {
          port: 5000,
          hello_service_port: 5001,
          customer_service_port: 5002
      }
      

      This settings file has three entries: port: 5000 assigns port 5000 to the main Mountebank instance, hello_service_port: 5001 assigns port 5001 to the Hello World test service that you will create in a later step, and customer_service_port: 5002 assigns port 5002 to the mock service app that will respond with CSV data. If the ports here are occupied, feel free to change them to whatever you want. module.exports = makes it possible for your other files to import these settings.

      In this step, you used settings.js to define the ports that Mountebank and your mock services will listen to and made these settings available to other parts of your app. In the next step, you will build an initialization script with these settings to start Mountebank.

      Step 3 — Building the Initialization Script

      In this step, you're going to create a file that starts an instance of Mountebank. This file will be the entry point of the application, meaning that, when you run the app, this script will run first. You will add more lines to this file as you build new service mocks.

      From the src directory, create a file called index.js and open it in your text editor:

      To start an instance of Mountebank that will run on the port specified in the settings.js file you created in the last step, add the following code to the file:

      app/src/index.js

      const mb = require('mountebank');
      const settings = require('./settings');
      
      const mbServerInstance = mb.create({
              port: settings.port,
              pidfile: '../mb.pid',
              logfile: '../mb.log',
              protofile: '../protofile.json',
              ipWhitelist: ['*']
          });
      

      This code does three things. First, it imports the Mountebank npm package that you installed earlier (const mb = require('mountebank');). Then, it imports the settings module you created in the previous step (const settings = require('./settings');). Finally, it creates an instance of the Mountebank server with mb.create().

      The server will listen at the port specified in the settings file. The pidfile, logfile, and protofile parameters are for files that Mountebank uses internally to record its process ID, specify where it keeps its logs, and set a file to load custom protocol implementations. The ipWhitelist setting specifies what IP addresses are allowed to communicate with the Mountebank server. In this case, you're opening it up to any IP address.

      Save and exit from the file.

      After this file is in place, enter the following command to run your application:

      The command prompt will disappear, and you will see the following:

      • info: [mb:5000] mountebank v2.0.0 now taking orders - point your browser to http://localhost:5000/ for help

      This means your application is open and ready to take requests.

      Next, check your progress. Open up a new terminal window and use curl to send the following GET request to the Mountebank server:

      • curl http://localhost:5000/

      This will return the following JSON response:

      Output

      { "_links": { "imposters": { "href": "http://localhost:5000/imposters" }, "config": { "href": "http://localhost:5000/config" }, "logs": { "href": "http://localhost:5000/logs" } } }

      The JSON that Mountebank returns describes the three different endpoints you can use to add or remove objects in Mountebank. By using curl to send reqests to these endpoints, you can interact with your Mountebank instance.

      When you're done, switch back to your first terminal window and exit the application using CTRL + C. This exits your Node.js app so you can continue adding to it.

      Now you have an application that successfully runs an instance of Mountebank. In the next step, you will create a Mountebank client that uses REST requests to add mock services to your Mountebank application.

      Step 4 — Building a Mountebank Client

      Mountebank communicates using a REST API. You can manage the resources of your Mountebank instance by sending HTTP requests to the different endpoints mentioned in the last step. To add a mock service, you send a HTTP POST request to the imposters endpoint. An imposter is the name for a mock service in Mountebank. Imposters can be simple or complex, depending on the behaviors you want in your mock.

      In this step, you will build a Mountebank client to automatically send POST requests to the Mountebank service. You could send a POST request to the imposters endpoint using curl or Postman, but you'd have to send that same request every time you restart your test server. If you're running a sample API with several mocks, it will be more efficient to write a client script to do this for you.

      Begin by installing the node-fetch library:

      • npm install -save node-fetch

      The node-fetch library gives you an implementation of the JavaScript Fetch API, which you can use to write shorter HTTP requests. You could use the standard http library, but using node-fetch is a lighter weight solution.

      Now, create a client module to send requests to Mountebank. You only need to post imposters, so this module will have one method.

      Use nano to create a file called mountebank-helper.js:

      • nano mountebank-helper.js

      To set up the client, put the following code in the file:

      app/src/mountebank-helper.js

      const fetch = require('node-fetch');
      const settings = require('./settings');
      
      function postImposter(body) {
          const url = `http://127.0.0.1:${settings.port}/imposters`;
      
          return fetch(url, {
                          method:'POST',
                          headers: { 'Content-Type': 'application/json' },
                          body: JSON.stringify(body)
                      });
      }
      
      module.exports = { postImposter };
      

      This code starts off by pulling in the node-fetch library and your settings file. This module then exposes a function called postImposter that posts service mocks to Mountebank. Next, body: determines that the function takes JSON.stringify(body), a JavaScript object. This object is what you're going to POST to the Mountebank service. Since this method is running locally, you run your request against 127.0.0.1 (localhost). The fetch method takes the object sent in the parameters and sends the POST request to the url.

      In this step, you created a Mountebank client to post new mock services to the Mountebank server. In the next step, you'll use this client to create your first mock service.

      Step 5 — Creating Your First Mock Service

      In previous steps, you built an application that creates a Mountebank server and code to call that server. Now it's time to use that code to build an imposter, or a mock service.

      In Mountebank, each imposter contains stubs. Stubs are configuration sets that determine the response that an imposter will give. Stubs can be further divided into combinations of predicates and responses. A predicate is the rule that triggers the imposter's response. Predicates can use lots of different types of information, including URLs, request content (using XML or JSON), and HTTP methods.

      Looked at from the point of view of a Model-View-Controller (MVC) app, an imposter acts like a controller and the stubs like actions within that controller. Predicates are routing rules that point toward a specific controller action.

      To create your first mock service, create a file called hello-service.js. This file will contain the definition of your mock service.

      Open hello-service.js in your text editor:

      Then add the following code:

      app/src/hello-service.js

      const mbHelper = require('./mountebank-helper');
      const settings = require('./settings');
      
      function addService() {
          const response = { message: "hello world" }
      
          const stubs = [
              {
                  predicates: [ {
                      equals: {
                          method: "GET",
                          "path": "/"
                      }
                  }],
                  responses: [
                      {
                          is: {
                              statusCode: 200,
                              headers: {
                                  "Content-Type": "application/json"
                              },
                              body: JSON.stringify(response)
                          }
                      }
                  ]
              }
          ];
      
          const imposter = {
              port: settings.hello_service_port,
              protocol: 'http',
              stubs: stubs
          };
      
          return mbHelper.postImposter(imposter);
      }
      
      module.exports = { addService };
      
      

      This code defines an imposter with a single stub that contains a predicate and a response. Then it sends that object to the Mountebank server. This code will add a new mock service that listens for GET requests to the root url and returns { message: "hello world" } when it gets one.

      Let's take a look at the addService() function that the preceding code creates. First, it defines a response message hello world:

          const response = { message: "hello world" }
      ...
      

      Then, it defines a stub:

      ...
              const stubs = [
              {
                  predicates: [ {
                      equals: {
                          method: "GET",
                          "path": "/"
                      }
                  }],
                  responses: [
                      {
                          is: {
                              statusCode: 200,
                              headers: {
                                  "Content-Type": "application/json"
                              },
                              body: JSON.stringify(response)
                          }
                      }
                  ]
              }
          ];
      ...
      

      This stub has two parts. The predicate part is looking for a GET request to the root (/) URL. This means that stubs will return the response when someone sends a GET request to the root URL of the mock service. The second part of the stub is the responses array. In this case, there is one response, which returns a JSON result with an HTTP status code of 200.

      The final step defines an imposter that contains that stub:

      ...
          const imposter = {
              port: settings.hello_service_port,
              protocol: 'http',
              stubs: stubs
          };
      ...
      

      This is the object you're going to send to the /imposters endpoint to create an imposter that mocks a service with a single endpoint. The preceding code defines your imposter by setting the port to the port you determined in the settings file, setting the protocol to HTTP, and assigning stubs as the imposter's stubs.

      Now that you have a mock service, the code sends it to the Mountebank server:

      ...
          return mbHelper.postImposter(imposter);
      ...
      

      As mentioned before, Mountebank uses a REST API to manage its objects. The preceding code uses the postImposter() function that you defined earlier to send a POST request to the server to activate the service.

      Once you are finished with hello-service.js, save and exit from the file.

      Next, call the newly created addService() function in index.js. Open the file in your text editor:

      To make sure that the function is called when the Mountebank instance is created, add the following highlighted lines:

      app/src/index.js

      const mb = require('mountebank');
      const settings = require('./settings');
      const helloService = require('./hello-service');
      
      const mbServerInstance = mb.create({
              port: settings.port,
              pidfile: '../mb.pid',
              logfile: '../mb.log',
              protofile: '../protofile.json',
              ipWhitelist: ['*']
          });
      
      mbServerInstance.then(function() {
          helloService.addService();
      });
      

      When a Mountebank instance is created, it returns a promise. A promise is an object that does not determine its value until later. This can be used to simplify asynchronous function calls. In the preceding code, the .then(function(){...}) function executes when the Mountebank server is initialized, which happens when the promise resolves.

      Save and exit index.js.

      To test that the mock service is created when Mountebank initializes, start the application:

      The Node.js process will occupy the terminal, so open up a new terminal window and send a GET request to http://localhost:5001/:

      • curl http://localhost:5001

      You will receive the following response, signifying that the service is working:

      Output

      {"message": "hello world"}

      Now that you tested your application, switch back to the first terminal window and exit the Node.js application using CTRL + C.

      In this step, you created your first mock service. This is a test service mock that returns hello world in response to a GET request. This mock is meant for demonstration purposes; it doesn't really give you anything you couldn't get by building a small Express application. In the next step, you'll create a more complex mock that takes advantage of some of Mountebank's features.

      Step 6 — Building a Data-Backed Mock Service

      While the type of service you created in the previous step is fine for some scenarios, most tests require a more complex set of responses. In this step, you're going to create a service that takes a parameter from the URL and uses it to look up a record in a CSV file.

      First, move back to the main app directory:

      Create a folder called data:

      Open a file for your customer data called customers.csv:

      Add in the following test data so that your mock service has something to retrieve:

      app/data/customers.csv

      id,first_name,last_name,email,favorite_color 
      1,Erda,Birkin,ebirkinb@google.com.hk,Aquamarine
      2,Cherey,Endacott,cendacottc@freewebs.com,Fuscia
      3,Shalom,Westoff,swestoffd@about.me,Red
      4,Jo,Goulborne,jgoulbornee@example.com,Red
      

      This is fake customer data generated by the API mocking tool Mockaroo, similar to the fake data you'd load into a customers table in the service itself.

      Save and exit the file.

      Then, create a new module called customer-service.js in the src directory:

      • nano src/customer-service.js

      To create an imposter that listens for GET requests on the /customers/ endpoint, add the following code:

      app/src/customer-service.js

      const mbHelper = require('./mountebank-helper');
      const settings = require('./settings');
      
      function addService() {
          const stubs = [
              {
                  predicates: [{
                      and: [
                          { equals: { method: "GET" } },
                          { startsWith: { "path": "/customers/" } }
                      ]
                  }],
                  responses: [
                      {
                          is: {
                              statusCode: 200,
                              headers: {
                                  "Content-Type": "application/json"
                              },
                              body: '{ "firstName": "${row}[first_name]", "lastName": "${row}[last_name]", "favColor": "${row}[favorite_color]" }'
                          },
                          _behaviors: {
                              lookup: [
                                  {
                                      "key": {
                                        "from": "path",
                                        "using": { "method": "regex", "selector": "/customers/(.*)$" },
                                        "index": 1
                                      },
                                      "fromDataSource": {
                                        "csv": {
                                          "path": "data/customers.csv",
                                          "keyColumn": "id"
                                        }
                                      },
                                      "into": "${row}"
                                    }
                              ]
                          }
                      }
                  ]
              }
          ];
      
          const imposter = {
              port: settings.customer_service_port,
              protocol: 'http',
              stubs: stubs
          };
      
          return mbHelper.postImposter(imposter);
      }
      
      module.exports = { addService };
      
      

      This code defines a service mock that looks for GET requests with a URL format of customers/<id>. When a request is received, it will query the URL for the id of the customer and then return the corresponding record from the CSV file.

      This code uses a few more Mountebank features than the hello service you created in the last step. First, it uses a feature of Mountebank called behaviors. Behaviors are a way to add functionality to a stub. In this case, you're using the lookup behavior to look up a record in a CSV file:

      ...
        _behaviors: {
            lookup: [
                {
                    "key": {
                      "from": "path",
                      "using": { "method": "regex", "selector": "/customers/(.*)$" },
                      "index": 1
                    },
                    "fromDataSource": {
                      "csv": {
                        "path": "data/customers.csv",
                        "keyColumn": "id"
                      }
                    },
                    "into": "${row}"
                  }
            ]
        }
      ...
      

      The key property uses a regular expression to parse the incoming path. In this case, you're taking the id that comes after customers/ in the URL.

      The fromDataSource property points to the file you're using to store your test data.

      The into property injects the result into a variable ${row}. That variable is referenced in the following body section:

      ...
        is: {
            statusCode: 200,
            headers: {
                "Content-Type": "application/json"
            },
            body: '{ "firstName": "${row}[first_name]", "lastName": "${row}[last_name]", "favColor": "${row}[favorite_color]" }'
        },
      ...
      

      The row variable is used to populate the body of the response. In this case, it's a JSON string with the customer data.

      Save and exit the file.

      Next, open index.js to add the new service mock to your initialization function:

      Add the highlighted line:

      app/src/index.js

      const mb = require('mountebank');
      const settings = require('./settings');
      const helloService = require('./hello-service');
      const customerService = require('./customer-service');
      
      const mbServerInstance = mb.create({
              port: settings.port,
              pidfile: '../mb.pid',
              logfile: '../mb.log',
              protofile: '../protofile.json',
              ipWhitelist: ['*']
          });
      
      mbServerInstance.then(function() {
          helloService.addService();
          customerService.addService();
      });
      
      

      Save and exit the file.

      Now start Mountebank with npm start. This will hide the prompt, so open up another terminal window. Test your service by sending a GET request to localhost:5002/customers/3. This will look up the customer information under id 3.

      • curl localhost:5002/customers/3

      You will see the following response:

      Output

      { "firstName": "Shalom", "lastName": "Westoff", "favColor": "Red" }

      In this step, you created a mock service that read data from a CSV file and returned it as a JSON response. From here, you can continue to build more complex mocks that match the services you need to test.

      Conclusion

      In this article you created your own service-mocking application using Mountebank and Node.js. Now you can build mock services and share them with your team. Whether it's a complex scenario involving a vendor service you need to test around or a simple mock while you wait for another team to finish their work, you can keep your team moving by creating mock services.

      If you want to learn more about Mountebank, check out their documentation. If you'd like to containerize this application, check out Containerizing a Node.js Application for Development With Docker Compose. If you'd like to run this application in a production-like environment, check out How To Set Up a Node.js Application for Production on Ubuntu 18.04.



      Source link