Zuplo logo
Back to all articles
API Mocking

The JsFiddle of APIs?

Josh Twist
March 28, 2022
1 min read

Learn the fastest way to set up an API Mock server using an API Gateway. Create mocks while you build out your services.

Zuplo is so fast and flexible, it is the easiest way to setup a mock API. Here we create a simple todo API (of course 🤦🏼‍♂️). We add our 'sleep' policy to make it slow too - so you can call this from your UI client and simulate long loading times.

Length: 2 minutes

Here's the code for the request handler:

TypeScriptts
import { ZuploContext, ZuploRequest } from "@zuplo/runtime";

export default async function (request: ZuploRequest, context: ZuploContext) {
  return [
    { text: "Learn Javascript", done: false },
    { text: "Learn Typescript", done: false },
    { text: "Play around in Zuplo", done: true },
    { text: "Build something awesome", done: true },
  ];
}

Have fun, APIFiddling!