Skip to content

Commit 1632aea

Browse files
committed
Minor Changes
- Add Title of ejs - create error middle ware
1 parent 55f6d8f commit 1632aea

File tree

2 files changed

+11
-68
lines changed

2 files changed

+11
-68
lines changed

routes/song.js

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -6,66 +6,5 @@ const router = express.Router();
66

77
router.route("/").get(getAllSongs);
88
router.route("/new").post(newSong);
9-
// /**
10-
// * @route GET /songs
11-
// * @desc Get all songs
12-
// * @access Public
13-
// */
14-
// router.get("/", async (req, res) => {
15-
// try {
16-
// const songs = await getAllSongs();
17-
// return res.json(songs);
18-
// } catch (error) {
19-
// console.error("Error fetching songs:", error.message);
20-
// res.status(500).json({ error: "Internal Server Error" });
21-
// }
22-
// });
23-
24-
// /**
25-
// * @route POST /songs/new
26-
// * @desc Create new songs and update associated album
27-
// * @access Public
28-
// */
29-
// router.post("/new", async (req, res) => {
30-
// try {
31-
// const songsData = req.body;
32-
// console.log(songsData);
33-
34-
// // Ensure songsData is an array
35-
// if (!Array.isArray(songsData)) {
36-
// return res
37-
// .status(400)
38-
// .json({ error: "Invalid request. Expected an array of songs." });
39-
// }
40-
41-
// const savedSongs = [];
42-
43-
// for (const { name, artist, albumId, duration } of songsData) {
44-
// // Create a new song
45-
// const song = new Song({ name, artist, albumId, duration });
46-
// const savedSong = await song.save();
47-
48-
// // Update the associated album with the new song's ID
49-
// const validAlbum = await getAlbum(albumId);
50-
51-
// if (!validAlbum) {
52-
// return res.status(404).json({ error: "Album not found" });
53-
// }
54-
55-
// // Add the new song's ID to the album's tracks array
56-
// validAlbum.tracks.push(savedSong._id);
57-
// await validAlbum.save();
58-
59-
// savedSongs.push(savedSong);
60-
// }
61-
62-
// res.json(savedSongs);
63-
// } catch (error) {
64-
// console.error("Error creating songs and updating album:", error.message);
65-
// res.status(500).json({ error: "Internal Server Error" });
66-
// }
67-
// });
68-
69-
// module.exports = router;
709

7110
module.exports = router;

views/index.ejs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
<head>
44
<meta charset="UTF-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6-
<title>Taylor Swift API</title>
6+
<title>
7+
Taylor Swift API | Open Source API for Taylor Swift Albums and Songs
8+
</title>
79
<!-- Include Tailwind CSS via CDN -->
810
<link
911
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/tailwind.min.css"
@@ -151,11 +153,11 @@
151153
>GET</span
152154
>
153155
<a
154-
href="https://taylor-swift-api.onrender.com/album/65e41600f129029a20653d42"
156+
href="https://taylor-swift-api.onrender.com/album/Taylor%20Swift"
155157
class="bg-gray-200 px-2 hover:underline py-1 rounded"
156158
target="_blank"
157159
>
158-
<code>/album/:id</code>
160+
<code>/album/:name</code>
159161
</a>
160162
</div>
161163

@@ -192,11 +194,11 @@
192194
>GET</span
193195
>
194196
<a
195-
href="https://taylor-swift-api.onrender.com/songs"
197+
href="https://taylor-swift-api.onrender.com/song/Time%20McGraw"
196198
class="bg-gray-200 px-2 hover:underline py-1 rounded"
197199
target="_blank"
198200
>
199-
<code>/song/:id</code>
201+
<code>/song/:name</code>
200202
</a>
201203
</div>
202204
<p class="text-base">
@@ -206,9 +208,11 @@
206208
</li>
207209
</ol>
208210
<hr />
209-
<button class="bg-gray-300 mt-4 text-center py-2 text-black w-full">
211+
<button
212+
class="flex sm:hidden bg-gray-300 mt-4 text-center py-2 text-black w-full"
213+
>
210214
<a
211-
class="flex sm:hidden items-center justify-center gap-2"
215+
class="items-center justify-center gap-2"
212216
href="https://github.com/lakshaykamat/taylor-swift-api"
213217
target="_blank"
214218
>

0 commit comments

Comments
 (0)