- Nextjs as front
- NodeJS Express as external API
- fetcher with auth
- Rotative accessToken and refreshToken
- Clone and test
- Swap the static data with your query database
npm i
npm run dev
import { get, post, put, remove } from "../utils/auth/";
const Component = async () => {
// GET
const users = await get("/api/users");
console.log(users);
// POST
const user = await post("/api/users", { name: "John Doe" });
console.log(user);
// PUT
const user = await put("/api/users", { name: "John Doe" });
console.log(user);
// DELETE
const user = await remove("/api/users/1");
console.log(user);
}