{"id":21997825,"url":"https://github.com/benevanio/game-api","last_synced_at":"2026-04-06T09:32:51.049Z","repository":{"id":264167928,"uuid":"892569693","full_name":"Benevanio/game-api","owner":"Benevanio","description":null,"archived":false,"fork":false,"pushed_at":"2024-11-22T11:13:27.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-23T04:45:26.244Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Benevanio.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-22T11:11:13.000Z","updated_at":"2024-11-22T11:13:31.000Z","dependencies_parsed_at":"2024-11-22T12:21:03.250Z","dependency_job_id":"e2651ce6-6f1e-4a47-91e5-8826345a1366","html_url":"https://github.com/Benevanio/game-api","commit_stats":null,"previous_names":["benevanio/game-api"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Benevanio/game-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Benevanio%2Fgame-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Benevanio%2Fgame-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Benevanio%2Fgame-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Benevanio%2Fgame-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Benevanio","download_url":"https://codeload.github.com/Benevanio/game-api/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Benevanio%2Fgame-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31466621,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-06T08:36:52.050Z","status":"ssl_error","status_checked_at":"2026-04-06T08:36:51.267Z","response_time":112,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-29T22:18:19.130Z","updated_at":"2026-04-06T09:32:51.033Z","avatar_url":"https://github.com/Benevanio.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Game API\n\nThis is a simple RESTful API built with Node.js and Express for managing a collection of video games. It allows users to perform CRUD operations on a database of games. The API supports retrieving all games, getting a specific game by its ID, adding new games, updating existing games, and deleting games.\n\n## Prerequisites\n\nBefore running the application, ensure you have the following installed on your local machine:\n\n- Node.js\n- npm (Node Package Manager)\n\n## Installation\n\n1. Clone the repository or download the project files to your local machine.\n\n```bash\ngit clone https://github.com/Benevanio/game-api\ncd \u003cproject-folder\u003e\n```\n\n2. Install the necessary dependencies by running the following command:\n\n```bash\nnpm install\n```\n\n## Usage\n\n1. Start the server by running:\n\n```bash\nnode app.js\n```\n\n2. The server will run on `http://localhost:3000`. You can now interact with the API using HTTP requests.\n\n### Endpoints\n\n- **GET `/games`**  \n  Retrieves a list of all games in the database.\n\n  **Response:**\n  ```json\n  {\n      \"games\": [\n          {\n              \"id\": 23,\n              \"title\": \"Call of Duty\",\n              \"year\": 2019,\n              \"price\": 60\n          },\n          {\n              \"id\": 65,\n              \"title\": \"GTA V\",\n              \"year\": 2013,\n              \"price\": 80\n          },\n          ...\n      ]\n  }\n  ```\n\n- **GET `/game/:id`**  \n  Retrieves a specific game by its `id`.\n\n  **Parameters:**\n  - `id`: The ID of the game.\n\n  **Response:**\n  ```json\n  {\n      \"id\": 23,\n      \"title\": \"Call of Duty\",\n      \"year\": 2019,\n      \"price\": 60\n  }\n  ```\n\n  **Status Codes:**\n  - `200`: Success, game found.\n  - `400`: Invalid ID format.\n  - `404`: Game not found.\n\n- **POST `/game`**  \n  Adds a new game to the collection.\n\n  **Request Body:**\n  ```json\n  {\n      \"title\": \"Game Title\",\n      \"year\": 2024,\n      \"price\": 40\n  }\n  ```\n\n  **Response:**\n  - `200`: Game added successfully.\n  - `400`: Missing required fields (title, year, or price).\n\n- **PUT `/game/:id`**  \n  Updates an existing game by its `id`.\n\n  **Parameters:**\n  - `id`: The ID of the game.\n\n  **Request Body:**\n  ```json\n  {\n      \"title\": \"Updated Title\",\n      \"year\": 2024,\n      \"price\": 50\n  }\n  ```\n\n  **Response:**\n  - `200`: Game updated successfully.\n  - `400`: Invalid ID or missing fields.\n  - `404`: Game not found.\n\n- **DELETE `/game/:id`**  \n  Deletes a specific game by its `id`.\n\n  **Parameters:**\n  - `id`: The ID of the game to be deleted.\n\n  **Response:**\n  - `200`: Game deleted successfully.\n  - `400`: Invalid ID format.\n  - `404`: Game not found.\n\n## Database\n\nThe API uses a simple in-memory database to store the games, which is initialized with some sample data:\n\n```json\n{\n    \"games\": [\n        { \"id\": 23, \"title\": \"Call of Duty\", \"year\": 2019, \"price\": 60 },\n        { \"id\": 65, \"title\": \"GTA V\", \"year\": 2013, \"price\": 80 },\n        { \"id\": 2, \"title\": \"Minecraft\", \"year\": 2010, \"price\": 20 },\n        { \"id\": 45, \"title\": \"FIFA 12\", \"year\": 2012, \"price\": 15 },\n        { \"id\": 40, \"title\": \"God of War\", \"year\": 2018, \"price\": 50 }\n    ]\n}\n```\n\nNote that the data is not persistent between server restarts, as it is stored only in memory.\n\n## Error Handling\n\nThe API returns appropriate HTTP status codes for various error scenarios:\n\n- `400`: Bad request, such as missing required fields or invalid ID format.\n- `404`: Not found, when a game with the given ID does not exist.\n- `500`: Internal server error (if any unexpected issues occur).\n\n## Contributing\n\nIf you'd like to contribute to this project, feel free to fork it and submit a pull request with your improvements or fixes.\n\n## License\n\nThis project is open-source and available under the [MIT License](LICENSE).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenevanio%2Fgame-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbenevanio%2Fgame-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenevanio%2Fgame-api/lists"}