feat: add one-command local development stack
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
const apiBaseUrl = import.meta.env?.VITE_API_BASE_URL ?? 'http://localhost:3000/api/v1';
|
||||
const apiBaseUrl = import.meta.env?.VITE_API_BASE_URL ?? '/api/v1';
|
||||
|
||||
export async function searchCatalog({ query = '', page = 1, limit = 20 } = {}) {
|
||||
const params = new URLSearchParams({ query, page: String(page), limit: String(limit) });
|
||||
|
||||
@@ -6,7 +6,7 @@ import { getPublicListing } from '../src/services/catalog-service.js';
|
||||
test('fetches a public listing detail through the API service', async () => {
|
||||
const originalFetch = globalThis.fetch;
|
||||
globalThis.fetch = async (url) => {
|
||||
assert.equal(url, 'http://localhost:3000/api/v1/public/listings/listing-1');
|
||||
assert.equal(url, '/api/v1/public/listings/listing-1');
|
||||
return { ok: true, async json() { return { data: { id: 'listing-1' } }; } };
|
||||
};
|
||||
|
||||
@@ -20,7 +20,7 @@ test('fetches a public listing detail through the API service', async () => {
|
||||
test('encodes catalog search pagination in the API request', async () => {
|
||||
const originalFetch = globalThis.fetch;
|
||||
globalThis.fetch = async (url) => {
|
||||
assert.equal(url, 'http://localhost:3000/api/v1/public/search?query=card+set&page=3&limit=20');
|
||||
assert.equal(url, '/api/v1/public/search?query=card+set&page=3&limit=20');
|
||||
return { ok: true, async json() { return { data: { items: [], pagination: {} } }; } };
|
||||
};
|
||||
|
||||
@@ -35,7 +35,7 @@ test('encodes catalog search pagination in the API request', async () => {
|
||||
test('fetches a public product using its stable slug URL', async () => {
|
||||
const originalFetch = globalThis.fetch;
|
||||
globalThis.fetch = async (url) => {
|
||||
assert.equal(url, 'http://localhost:3000/api/v1/public/products/pikachu-plush');
|
||||
assert.equal(url, '/api/v1/public/products/pikachu-plush');
|
||||
return { ok: true, async json() { return { data: { slug: 'pikachu-plush' } }; } };
|
||||
};
|
||||
|
||||
|
||||
@@ -12,5 +12,8 @@ export default defineConfig({
|
||||
},
|
||||
server: {
|
||||
port: 5173,
|
||||
proxy: {
|
||||
'/api': 'http://localhost:3000',
|
||||
},
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user