{"id":15097706,"url":"https://github.com/instamenta/news-api","last_synced_at":"2026-01-26T20:16:07.870Z","repository":{"id":142287193,"uuid":"612248587","full_name":"instamenta/news-api","owner":"instamenta","description":"Dockerized REST News API with all CRUD operations","archived":false,"fork":false,"pushed_at":"2023-03-13T01:59:51.000Z","size":2992,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-27T15:51:11.536Z","etag":null,"topics":["api-rest","docker","docker-compose","javascript","joi","koa","newsapi","node-js"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/instamenta.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2023-03-10T14:18:01.000Z","updated_at":"2023-03-12T02:50:42.000Z","dependencies_parsed_at":null,"dependency_job_id":"cb410b79-b966-4529-b933-51968c5ebc0a","html_url":"https://github.com/instamenta/news-api","commit_stats":{"total_commits":26,"total_committers":1,"mean_commits":26.0,"dds":0.0,"last_synced_commit":"7cf2ab6b7495dfaf6b20b9297d40db679f8c2e9c"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/instamenta/news-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/instamenta%2Fnews-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/instamenta%2Fnews-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/instamenta%2Fnews-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/instamenta%2Fnews-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/instamenta","download_url":"https://codeload.github.com/instamenta/news-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/instamenta%2Fnews-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28787221,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-26T13:55:28.044Z","status":"ssl_error","status_checked_at":"2026-01-26T13:55:26.068Z","response_time":59,"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":["api-rest","docker","docker-compose","javascript","joi","koa","newsapi","node-js"],"created_at":"2024-09-25T16:25:02.224Z","updated_at":"2026-01-26T20:16:07.850Z","avatar_url":"https://github.com/instamenta.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# News-Api\n\nA simple web application for managing news articles.\n\n## Requirements\nBefore you can run this application, you need to have the following software installed on your computer:\n\n* Docker\n* Docker Compose\n\n## Usage\nOnce the application is running, you can access it by visiting http://localhost:3000 in your web browser.\n\n## API Endpoints\nThe following endpoints are available:\n\n* GET /news - Get a list of news articles\n* POST /news - Create a new news article\n* GET /news/:id - Get a specific news article\n* PUT /news/:id - Update a specific news article\n* DELETE /news/:id - Delete a specific news article\n\n## API Documentation\n\n### Get News\nRetrieve a list of news articles.\n```\nGET http://localhost:3000/news\n```\n### Get News with Custom Query\n\nendpoint is used to fetch all news articles from the database. \nIt accepts several query parameters that can be used to customize the returned results:\n\n* sortBy: the field to sort the results by (e.g. title, createdAt, etc.)\n* sortOrder: the sort order, which can be either asc (ascending) or desc (descending)\n* keyword: a keyword to search for in the news article's title or body\n* page: the page number to fetch (e.g. 1, 2, etc.)\n* pageSize: the number of news articles to fetch per page\n\n* returns a response containing the requested news articles and the total count of articles matching the query.\n\nHere is an example of how to call this endpoint:\n```\nGET 'http://localhost:3000/news?sortBy=title\u0026sortOrder=asc\u0026keyword=breaking\u0026page=1\u0026pageSize=10' \n```\n\nThis would fetch the first page of news articles containing the keyword \"breaking\",\nsorted by title in ascending order, with a page size of 10 articles per page.\n\n### Create News\n\nCreate a new news article.\n```\nPOST http://localhost:3000/news\nContent-Type: application/json\n{\n  \"title\": \"News Title\",\n  \"shortDescription\": \"News Description\",\n  \"text\": \"Text...\"\n}\n```\n### Get News Article\nRetrieve a single news article by ID.\n```\nGET http://localhost:3000/news/:id\n```\n### Update News Article\nUpdate a single news article by ID.\n```\nPUT http://localhost:3000/news/:id\nContent-Type: application/json\n{\n  \"title\": \"Updated News Title\",\n  \"shortDescription\": \"Updated News Description\",\n  \"text\": \"UPDATED Text....\"\n}\n```\n### Delete News Article\nDelete a single news article by ID.\n```\nDELETE http://localhost:3000/news/:id\n```\n\n## to Test the News Api with the REST Client extension: \nthe ./rest.http file is used with the REST Client extension for VS Code to Quicly test the DataBase\n\n## Setup\nTo set up this application, follow these steps:\n\n1. Clone the repository:\n\n```\ngit clone https://github.com/\u003cusername\u003e/news-website-app.git\n```\n2. Navigate to the project directory:\n\n```\ncd news-website-app\n```\n3. Create a new file named .env in the project directory, and add the following line:\n\n```\nMONGODB_URI=mongodb://db:27017/news-app\n```\nThis environment variable specifies the URI of the MongoDB database.\n\n4. Run the following command to start the application:\n\n```\ndocker-compose up --build\n```\n* This command will build and start the application containers.\n\n## to Build with Docker: \n\nTo build the Docker image for your app, open a terminal in the root directory of \nyour project and run the following command ( it's important to keep the dot \".\" at the end ):\n```\ndocker build -t news-api .\n```\nThis will build a Docker image named news-api using the Dockerfile in the current directory (.). \nOnce the image is built, you can run the Docker container using the docker run command:\n```\ndocker-compose up\n```\nCongrats now you got a running container Docker Stack of two containers \n\"db-1\" and \"app-1\".\n\n## Setup 2\n\n1. Clone the repository:\n```\ngit clone https://github.com/instamenta/news-website.git\n```\n2. Install dependencies:\n```\ncd news-app\n```\n```\nnpm install\n```\n3. Create a .env file in the root directory with the following content:\n```\nMONGODB_URI=mongodb://localhost:27017/news-app\nPORT=3000\n```\nNote: Change the MONGODB_URI value to the appropriate MongoDB connection string if necessary.\n\n4. Seed the database with sample data:\n```\nnpm run seed\n```\n## Start\nTo start the application, run:\n```\nnode ./app.js\n```\n## Test\n\nTo run the test suite for this application, follow these steps:\n\n1. Start the application containers:\n```\ndocker-compose up --build\n```\n\n2. Open a new terminal window and navigate to the project directory:\n```\ncd news-website-app\n```\n3. Run the following command to execute the test suite:\n```\ndocker-compose run app npm test\n```\n* This command will start a new container and run the test suite inside it.\n\n\n## Troubleshooting\nIf you encounter any issues while running this application, try the following steps:\n\n* Make sure that Docker and Docker Compose are installed and running correctly on your computer.\n* Check the application logs for any error messages or stack traces.\n* Try stopping and restarting the application containers using the `docker-compose down` and `docker-compose up`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finstamenta%2Fnews-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finstamenta%2Fnews-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finstamenta%2Fnews-api/lists"}