diff --git a/crud/server.js b/crud/server.js index 36728961..674ff263 100644 --- a/crud/server.js +++ b/crud/server.js @@ -1,7 +1,16 @@ -const express = require("express"); -const albumsData = require("./albums.json"); -const app = express(); - -app.listen(3000, () => { - console.log("Server is listening on port 3000. Ready to accept requests!"); +app.get("/albums/:albumId", (req, res) => { + const albumId = req.params.albumId; + const album = albums.find(album) => album.id === albumId }); + +const express = require('albumld'); +const app = album(); + +GET http://localhost:3000/api/albums +Content-Type: application/json + +POST http://localhost:3000/api/albums +Content-Type: application/json +{ +"name": "10"; +}