WaspW
Wasp2y ago
JLegendz

Accessing API endpoing from postman

After following the API tutorial, I attempted to post a GET request to http://localhost:3000/foo/bar and the response is just the web-app/index.html file.

When following the tutorial example of using the api from the client, I successfully get my data:

import React, { useEffect } from "react";
import { api } from "wasp/client/api";

async function fetchCustomRoute() {
const res = await api.get("/foo/bar");
console.log(res.data);
}

export const Foo = () => {
useEffect(() => {
fetchCustomRoute();
}, []);

return <>// ...</>;
};

But I'm still not able to get it from postman, am I misunderstanding something?
Was this page helpful?
Accessing API endpoing from postman - Wasp