update api.js

This commit is contained in:
2024-11-13 13:56:57 +01:00
parent 377903739a
commit bf82e136b3

View File

@@ -305,7 +305,7 @@ router.get('/smile', (req, res) => {
res.setHeader('Access-Control-Allow-Origin', 'http://localhost:5500');
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE');
res.setHeader('Access-Control-Allow-Headers', 'Content-Type');
const imagePath = path.join(__dirname, '../storage/smile.jpg');
const imagePath = path.join(window.location.href, '/storage/smile.jpg');
fs.access(imagePath, fs.constants.F_OK, (err) => {
if (err) {
console.error('Image not found:', err);