feat: Containerize services with Docker Compose (PostgreSQL, Strapi CMS, Express Backend, Nginx Frontend) on custom ports >9000
This commit is contained in:
@@ -1,17 +1,28 @@
|
||||
import { Router } from 'express';
|
||||
import { getContent, updateSection, updateAllContent } from '../db.js';
|
||||
import { requireAuth } from '../auth.js';
|
||||
import { getStrapiBlogs } from '../strapi.js';
|
||||
import seedContent from '../seed/default-content.json' with { type: 'json' };
|
||||
|
||||
const VALID_SECTIONS = Object.keys(seedContent);
|
||||
|
||||
const router = Router();
|
||||
|
||||
router.get('/', (_req, res) => {
|
||||
router.get('/', async (_req, res) => {
|
||||
const { content, updatedAt } = getContent();
|
||||
const strapiItems = await getStrapiBlogs();
|
||||
if (strapiItems && content.insights) {
|
||||
content.insights.items = strapiItems;
|
||||
}
|
||||
res.json({ ...content, _updatedAt: updatedAt });
|
||||
});
|
||||
|
||||
router.get('/blogs', async (_req, res) => {
|
||||
const { content } = getContent();
|
||||
const strapiItems = await getStrapiBlogs();
|
||||
res.json(strapiItems || content.insights?.items || []);
|
||||
});
|
||||
|
||||
router.put('/', requireAuth, (req, res) => {
|
||||
const { _updatedAt, ...content } = req.body;
|
||||
const updatedAt = updateAllContent(content);
|
||||
|
||||
Reference in New Issue
Block a user