Skip to content

Commit 9fe8019

Browse files
committed
Minor Changes
1 parent 1632aea commit 9fe8019

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

app.js

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,15 @@ app.set("view engine", "ejs");
3232
app.set("views", path.join(__dirname, "views"));
3333

3434
app.get("/", async (req, res) => {
35-
try {
36-
// Fetch the albums data from your database
37-
const albums = await Album.find({}, "title releaseYear").lean();
38-
// Render the EJS template with the data
39-
res.render("index", {
40-
appName: "Taylor Swift API",
41-
albums: albums,
42-
});
43-
} catch (error) {
44-
console.error("Error fetching albums:", error.message);
45-
res.status(500).send("Internal Server Error");
46-
}
35+
const githubLink = "https://github.com/lakshaykamat/taylor-swift-api";
36+
const credist = [
37+
{ name: "Lakshay Kamat", githubLink: "https://github.com/lakshaykamat" },
38+
{ name: "Ruchi Singh", githubLink: "https://github.com/ruchisingh-dev" },
39+
];
40+
// Render the EJS template with the data
41+
res.render("index", {
42+
appName: "Taylor Swift API",
43+
});
4744
});
4845

4946
// Use routes from separate files

middlewares/errorMiddleware.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
const errorHandler = (res, error, status = 500) => {
2+
console.error("Error:", error.message);
3+
res.status(status).json({ error: "Internal Server Error" });
4+
};
5+
6+
module.exports = errorHandler;

0 commit comments

Comments
 (0)