This is the backend API for the Songs App, a music application that provides endpoints for song data and user interactions.
- Node.js: JavaScript runtime for server-side development.
- Express.js: Web framework for Node.js, used to build the API.
- MongoDB: NoSQL database for storing data.
- Mongoose: Object Data Modeling (ODM) library for MongoDB and Node.js.
- TypeScript: Enhances JavaScript with static types.
- Swagger: API documentation tool for generating interactive API documentation.
- ESLint: Linting tool to identify and fix problems in JavaScript/TypeScript code.
- Prettier: Code formatter to ensure consistent code style.
- Jest: Testing framework for running unit tests.
The API is deployed using Docker on Render.
- Frontend Repository: songs-app-frontend
-
Clone the Repository:
git clone https://github.com/yourusername/song-api.git Install Dependencies:
-
Install Dependencies:
cd song-api yarn install
-
Create Environment File: Create a
.env
file based on.env.example
and configure your environment variables.cp .env.example .env
-
Run the Application:
- Development Mode:
yarn dev
- Build the Application:
yarn build
- Start the Application:
yarn start
- Development Mode:
-
Linting: To check code quality and fix issues, run:
yarn lint
-
Testing: To run the tests, use:
yarn test
-
Swagger Documentation: Access the API documentation at
/docs
once the server is running. Swagger UI provides interactive documentation for the API endpoints.
yarn dev
: Runs the application in development mode with live reloading.yarn build
: Compiles TypeScript files into JavaScript using the production configuration.yarn start
: Starts the application in production mode.yarn lint
: Lints and fixes code issues using ESLint.yarn test
: Runs unit tests using Jest.yarn format
: Formats code using Prettier.yarn clean
: Removes thedist
directory.
GET /api/songs
: Retrieves a list of all songs.GET /api/songs/:id
: Retrieves a single song by ID.POST /api/songs
: Creates a new song.PUT /api/songs/:id
: Updates a song by ID.DELETE /api/songs/:id
: Deletes a song by ID.
{
"id": "string",
"title": "string",
"artist": "string",
"album": "string",
"genre": "string"
}
GitHub Actions are set up for linting and testing. The workflow runs automatically on push and pull request events. For more details, check the .github/workflows/lint-and-test.yml
file.
This project is licensed under the ISC License - see the LICENSE file for details.
- Express.js
- Mongoose
- TypeScript
- Swagger
- ESLint
- Prettier
- Jest
- Render
- Docker
- GitHub Actions
- ISC License
Zelalem Mekonnen - GitHub - LinkedIn
If you find this project helpful, please give it a star. Thanks!