Skip to content

Commit 7c03d3b

Browse files
show articles on home screen
Signed-off-by: Arnav Gupta <[email protected]>
1 parent 3e507cf commit 7c03d3b

32 files changed

+38955
-1
lines changed

Lecture17/blog-project/controllers/articles.js

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
const { Article, User } = require('../db/models')
22

3+
async function getAllArticles() {
4+
return await Article.findAll()
5+
}
36
async function getArticleById(id) {
47
return await Article.findOne({
58
include: [{ model: User, as: 'author' }],
@@ -27,6 +30,7 @@ async function createArticle(authorId, title, subtitle, body) {
2730
}
2831

2932
module.exports = {
33+
getAllArticles,
3034
getArticleById,
3135
getArticleByAuthorEmail,
3236
createArticle,

Lecture17/blog-project/package-lock.json

+78
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)