A RESTful API that allows users to fetch news articles from multiple sources based on their preferences.
Problem Statement -- Build a RESTful API that allows users to fetch news articles from multiple sources based on their preferences.
Endpoint | Description |
---|---|
POST /register |
Register a new user. |
POST /login |
Log in a user. |
GET /preferences |
Retrieve the news preferences for the logged-in user. |
PUT /preferences |
Update the news preferences for the logged-in user. |
GET /news |
Fetch news articles based on the logged-in user's preferences. |
Endpoint | Description |
---|---|
POST /news/:id/read |
Mark a news article as read. |
POST /news/:id/favorite |
Mark a news article as a favorite. |
GET /news/read |
Retrieve all read news articles. |
GET /news/favorites |
Retrieve all favorite news articles. |
GET /news/search/:keyword |
Search for news articles based on keywords. |
[
{
id: "string",
username: "string",
password: "string",
preferences: { categories: [Array], sources: [Array] },
// "createdAt": Date.now() // a.k.a Unix epoch // TODO
},
];