add example client

This commit is contained in:
2025-05-25 12:57:18 -04:00
parent 04c83cccb9
commit fa5d1e2689
15 changed files with 1867 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
import axios from 'axios';
const API_BASE_URL = 'http://localhost:3000';
export const login = async (username, password) => {
const response = await axios.post(`${API_BASE_URL}/login`, { username, password });
return response.data;
};
export const fetchMessages = async () => {
const response = await axios.get(`${API_BASE_URL}/messages`, { withCredentials: true });
return response.data;
};
export const createMessage = async (body) => {
const response = await axios.post(`${API_BASE_URL}/messages/new`, { body }, { withCredentials: true});
return response.data;
};