Update index.js
This commit is contained in:
parent
8b5a0d9b54
commit
ebe67484e7
1 changed files with 2 additions and 2 deletions
4
index.js
4
index.js
|
@ -120,7 +120,7 @@ app.post('/users/:username/posts', authenticate, (req, res) => {
|
||||||
res.status(201).json(post);
|
res.status(201).json(post);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Route to get a user’s posts
|
// Route to get a user's posts
|
||||||
app.get('/users/:username/posts', authenticate, (req, res) => {
|
app.get('/users/:username/posts', authenticate, (req, res) => {
|
||||||
const { username } = req.params;
|
const { username } = req.params;
|
||||||
|
|
||||||
|
@ -185,7 +185,7 @@ activityPubRouter.get('/users/:username/outbox', (req, res) => {
|
||||||
return res.status(404).json({ error: 'User not found' });
|
return res.status(404).json({ error: 'User not found' });
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fetch posts from this user’s outbox (from the DB)
|
// Fetch posts from this user's outbox (from the DB)
|
||||||
const userPosts = Object.values(db.get("posts") || {}).filter(post => post.author.username === username);
|
const userPosts = Object.values(db.get("posts") || {}).filter(post => post.author.username === username);
|
||||||
res.json(userPosts);
|
res.json(userPosts);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue