feat: initialize news service with core functionality

- Add package.json for project configuration and dependencies.
- Implement NewsApplication class to manage service lifecycle and HTTP pipeline.
- Create CategoryCatalog for managing news categories.
- Introduce ServiceConfig for environment variable management.
- Load environment variables from .env files.
- Develop NewsApiCompatibilityController to mimic NewsAPI endpoints.
- Create NewsController for querying and refreshing news data.
- Establish AbstractJsonRepository for JSON storage operations.
- Implement main entry point in index.js to bootstrap the application.
- Create CategoryNewsRepository for category-specific news storage.
- Add ConsoleLogger for structured logging.
- Implement NewsApiClient for fetching articles from NewsAPI.
- Develop NewsRefreshScheduler for scheduling news refresh tasks.
- Create NewsStorageService to coordinate news data management.
This commit is contained in:
2026-04-30 12:10:00 +08:00
commit 3d891d781c
21 changed files with 1901 additions and 0 deletions

18
package.json Normal file
View File

@@ -0,0 +1,18 @@
{
"name": "news-service",
"version": "1.0.0",
"description": "Standalone news microservice with scheduled sync and JSON storage",
"type": "commonjs",
"main": "src/index.js",
"scripts": {
"start": "node src/index.js",
"dev": "node --watch src/index.js"
},
"engines": {
"node": ">=20.0.0"
},
"dependencies": {
"express": "^4.21.2",
"node-cron": "^4.2.1"
}
}