improve dockerization

This commit is contained in:
Toni
2026-02-09 12:47:49 +01:00
parent a269f28a43
commit 342492e74d
6 changed files with 57 additions and 51 deletions

34
test-endpoints.js Normal file
View File

@@ -0,0 +1,34 @@
const axios = require('axios');
const BASE = 'http://localhost:3630/api/watchlist';
async function test() {
try {
console.log('1. Getting watchlist...');
const res1 = await axios.get(BASE);
console.log(` Success. Items: ${res1.data.length}`);
console.log('2. Adding "Inception"...');
const res2 = await axios.post(BASE, { title: 'Inception', type: 'movie' });
console.log(` Success. ID: ${res2.data.id}`);
const newId = res2.data.id;
console.log('3. Toggling watched status...');
const res3 = await axios.put(`${BASE}/${newId}/toggle`);
console.log(` Success. Watched: ${res3.data.watched}`);
console.log('4. Deleting item...');
const res4 = await axios.delete(`${BASE}/${newId}`);
console.log(` Success.`);
console.log('All tests passed!');
} catch (err) {
console.error('Test failed:', err.message);
if (err.response) {
console.error('Data:', err.response.data);
console.error('Status:', err.response.status);
}
}
}
test();