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