This file contains REST API documentation for both the Express Server (Node.js) and the ML API (Flask).
Description: Analyze the sentiment and political bias of a news article.
Request Body:
{
"title": "News headline",
"content": "Full news article content"
}Response:
{
"bias": "Left",
"sentiment": "Negative"
}Description: Analyze the emotional tone of a journal entry.
Request Body:
{
"entry": "I felt anxious after reading today's headlines."
}Response:
{
"emotion": "Anxious",
"score": -0.6
}Description: Fetch all stored news articles.
Response:
[
{
"title": "Market is booming",
"sentiment": "Positive",
"source": "Reuters"
}
]Description: Save a new journal entry.
Request Body:
{
"text": "I had a productive day."
}Response:
{
"sentiment": "Positive"
}Description: Submit a contact message.
Request Body:
{
"name": "John Doe",
"email": "john@example.com",
"message": "I love your project!"
}Response:
{
"success": true,
"message": "Contact message sent successfully."
}Description: Analyze custom text using ML model and return sentiment + emotion.
Request Body:
{
"text": "I am feeling hopeful today!"
}Response:
{
"sentiment": "Positive",
"emotion": "Happy"
}| Code | Description |
|---|---|
| 200 | Success |
| 400 | Bad Request |
| 404 | Not Found |
| 500 | Internal Server Error |
Access Swagger docs after starting server:
http://localhost:8080/api-docs
This document will grow as new endpoints are added.