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