- Renamed project to "tilbudgivern-unified" and updated package.json accordingly. - Created a new frontend server to proxy API requests and serve static files. - Added SQL scripts for inserting sample data and setting up pricing tables. - Configured Nginx for both HTTP and HTTPS with security headers and proxy settings. - Implemented a unified server to handle API requests and serve the frontend application. - Added endpoints for labor and material pricing management, including CRUD operations. - Introduced testing script for frontend API interaction.
44 lines
941 B
JavaScript
44 lines
941 B
JavaScript
const https = require('https');
|
|
|
|
// Test som frontend ville gøre - kald API endpoint
|
|
const testAPI = () => {
|
|
const options = {
|
|
hostname: 'tilbudsgiveren.alw.dk',
|
|
port: 443,
|
|
path: '/api/quotes/openai/stats',
|
|
method: 'GET',
|
|
headers: {
|
|
'User-Agent': 'Mozilla/5.0 (Test Browser)',
|
|
'Accept': 'application/json',
|
|
'Referer': 'https://tilbudsgiveren.alw.dk/'
|
|
}
|
|
};
|
|
|
|
const req = https.request(options, (res) => {
|
|
console.log(`Status: ${res.statusCode}`);
|
|
console.log(`Headers:`, res.headers);
|
|
|
|
let data = '';
|
|
res.on('data', (chunk) => {
|
|
data += chunk;
|
|
});
|
|
|
|
res.on('end', () => {
|
|
try {
|
|
const json = JSON.parse(data);
|
|
console.log('API Response:', json);
|
|
} catch (e) {
|
|
console.log('Response data:', data);
|
|
}
|
|
});
|
|
});
|
|
|
|
req.on('error', (e) => {
|
|
console.error('Error:', e.message);
|
|
});
|
|
|
|
req.end();
|
|
};
|
|
|
|
testAPI();
|