Back to all articles

The JsFiddle of APIs?

March 28, 2022
3 min read
Josh Twist
Josh TwistCo-founder & CEO

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:

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!