The Medical Articles API is a Node.js application built with Express.js for scraping and serving medical journal articles. It allows users to retrieve articles related to various medical conditions from the NIH National Library of Medicine’s PubMed database.
Before running the API, make sure you have the following software installed:
Clone this repository to your local machine:
git clone <repository-url>
Navigate to the project directory:
cd medical-articles-api
Install the project dependencies:
npm install
Start the server:
npm start
Welcome Message
Get Medical Articles
Get Specific Article By Disease
curl http://localhost:3005
"Welcome to my Medical Articles API"
curl http://localhost:3005/journals
{
"title": "Sample Article Title",
"url": "https://example.com/article/123",
"source": "NIH National Library of Medicine",
"keyword": "hidradenitis"
},
// More entries...
curl http://localhost:3005/journals/hidradenitis
{
"title": "Sample Article Title",
"url": "https://example.com/article/123",
"source": "NIH National Library of Medicine",
"keyword": "hidradenitis"
},
// More entries...
To improve performance, the API caches retrieved articles for a specified duration (default is 10 minutes). Cached data is stored in memory and served to subsequent requests until it expires.