Website restoration: Node.js backend, restored design, GitHub sync disabled
- Replaced broken .NET backend with Node.js/Express - Restored original website design with purple gradient hero - Updated homepage and shop pages with Bootstrap 5 responsive design - Disabled GitHub remote sync - all code now stored locally only - Created backup scripts and documentation - All changes saved on Ubuntu server at /var/www/SkyArtShop
This commit is contained in:
39
backend/routes/public.js
Normal file
39
backend/routes/public.js
Normal file
@@ -0,0 +1,39 @@
|
||||
const express = require('express');
|
||||
const { query } = require('../config/database');
|
||||
const router = express.Router();
|
||||
|
||||
router.get('/', async (req, res) => {
|
||||
try {
|
||||
const products = await query(
|
||||
'SELECT id, name, description, price, imageurl FROM products WHERE isactive = true ORDER BY createdat DESC LIMIT 8'
|
||||
);
|
||||
const sections = await query(
|
||||
'SELECT * FROM homepagesections ORDER BY displayorder ASC'
|
||||
);
|
||||
res.render('public/home', {
|
||||
title: 'Welcome - SkyArtShop',
|
||||
products: products.rows,
|
||||
sections: sections.rows
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Home page error:', error);
|
||||
res.status(500).send('Server error');
|
||||
}
|
||||
});
|
||||
|
||||
router.get('/shop', async (req, res) => {
|
||||
try {
|
||||
const products = await query(
|
||||
'SELECT id, name, description, price, imageurl, category FROM products WHERE isactive = true ORDER BY name ASC'
|
||||
);
|
||||
res.render('public/shop', {
|
||||
title: 'Shop - SkyArtShop',
|
||||
products: products.rows
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Shop page error:', error);
|
||||
res.status(500).send('Server error');
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
Reference in New Issue
Block a user