news widget design 11
This commit is contained in:
parent
91959ffcc6
commit
a2c44499c2
@ -7,6 +7,7 @@ const pool = new Pool({
|
||||
port: 5432,
|
||||
database: 'rivacube',
|
||||
user: 'alma',
|
||||
password: 'rivacube',
|
||||
connectionTimeoutMillis: 5000,
|
||||
query_timeout: 5000
|
||||
});
|
||||
@ -88,15 +89,15 @@ export async function GET() {
|
||||
console.log('Connected to PostgreSQL database');
|
||||
|
||||
const result = await client.query(
|
||||
'SELECT * FROM news ORDER BY date DESC LIMIT 5'
|
||||
'SELECT * FROM news ORDER BY date DESC LIMIT 3'
|
||||
);
|
||||
|
||||
const formattedNews = result.rows.map(article => {
|
||||
const { displayDate, timestamp } = formatDateTime(article.date);
|
||||
return {
|
||||
id: article.id,
|
||||
title: truncateText(article.title, 70),
|
||||
description: truncateText(article.description, 100),
|
||||
title: truncateText(article.title, 55),
|
||||
description: truncateText(article.description, 85),
|
||||
displayDate,
|
||||
timestamp,
|
||||
source: formatSource(article.source),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user