Skip to content

Getting started with mockingbird

ozkeisar edited this page Jun 3, 2024 · 2 revisions

Quickstart Guide to Mockingbird: Crafting Your Mock Server Environment

Introduction

Mockingbird stands out as a robust tool for developers looking to simulate server environments and streamline the front-end development process. In this article, we'll walk through the process of setting up a project in Mockingbird, creating a new server, adding routes, and defining responses.

Setting Up Your Server in Mockingbird

Starting a New Project

When you launch Mockingbird, you'll find yourself on the dashboard. Here's where the magic begins:

  1. Create a New Server:
    • Click on the + new server button on the left-hand navigation panel.
    • A dialogue box will appear where you can input the server's name and the port number it should listen on.
    • Input your desired server name and a port number that's open on your machine.
    • Click SAVE to establish your new server.

Structuring Your API

  1. Add a New Parent or Route:

    • To add a new category or parent directory for your endpoints, right-click on the server or an existing parent and select New Parent.
    • In the modal that appears, fill in the path and filename.
    • Click SAVE to add the new parent to your server structure.
  2. Creating Routes:

    • Right-click on a parent and select Add Route.
    • Specify the HTTP method and route path, and add a description if needed.
    • If your route requires parameters, specify where they are located (body, query, etc.), their keys, and values.
    • Click ADD ROUTE to finalize the route creation.

Defining Responses

  1. Set Up Responses:
    • Select a route from the sidebar to see the response configuration options.
    • Click on EDIT to define the response.
    • Choose the type of response: Function, Object, or Proxy.
    • Enter the response details. If it's an object, input the JSON directly. For a function, write the necessary JavaScript code.
    • Click SAVE after setting up your response logic.

Testing and Iteration

With your server, routes, and responses configured, you're ready to start the server and begin testing:

  • Click the Start Server button at the top right corner of your dashboard to make the server live.
  • Test the endpoints from your frontend application or API client.
  • Iterate over your responses as needed to simulate various scenarios.

Happy mocking!