API endpoints

Shipped uses Next.js 14 latest features, which include the new App Router.

The API endpoints of your product live in the /app/api/ folder. Any route.ts file, and each folder and subfolder, take part to the final endpoint URL.

For example:

/app/api/user/routes.ts -> http://localhost:3000/api/user

/app/api/user/profile/routes.ts -> http://localhost:3000/api/user/profile

/app/api/user/[id]/profile -> http://localhost:3000/api/user/1234/profile

The logic of each route resides in the route.ts files.

Make an API call from your website

To make API calls, use the library axios.

import axios from "axios";
import toast from "react-hot-toast";

  .post("/api/waitlist", {
  .then(() => {
    toast.success("You've been added to the waitlist!");
  .catch(() => {
    toast.error("Something went wrong. Please try again later.");
  .finally(() => {

Last updated