This is a mock API for managing playlists, built with Express.js and TypeScript.
- Navigate to the project directory:
cd Mock-Playlist-API - Install the dependencies:
npm install
In the project directory, you can run:
npm run dev: Starts the server in development mode usingnodemon. This will automatically restart the server whenever you make changes to your source files.npm run build: Compiles the TypeScript code into JavaScript, outputting the compiled files to thedistdirectory.npm start: Runs the compiled JavaScript server from thedistfolder. This is typically used for production environments after runningnpm run build.
The following endpoints are available:
GET /: Returns a welcome message.GET /api/playlists: Retrieves a list of all playlists.GET /api/playlists/:id: Retrieves a single playlist by its ID.POST /api/playlists: Creates a new playlist.- Request Body Example:
{ "name": "My New Playlist", "songs": ["Song E", "Song F"] }
- Request Body Example: