This is a simple News Management Node.js application developed using TypeScript and tsyringe. The app demonstrates the use of dependency injection with tsyringe to manage dependencies and provide a NewsService to handle news-related operations.
For Dev we use a MongoDB Free tier cluster https://cloud.mongodb.com/
To run the application locally, follow the steps below:
- Node.js and npm should be installed on your machine.
- Define following ENVIRONMENT variables.
DB_CONN_STRING
DB_NAME
COLLECTION_NAME
-
Clone this repository to your local machine.
-
Install the required dependencies using npm:
npm install
-
Build the TypeScript code using:
npm run build
-
Start the application:
npm start
The app should now be running locally at http://localhost:3000.
The application provides simple APIs for managing news articles. The news data is loaded from a sample JSON file stored in the data
folder.
GET /news
: Get all news articles.GET /news/:id
: Get a specific news article by ID.POST /news
: Create a new news article. (Note: TODO)PUT /news/:id
: Update a news article by ID. (Note: TODO)DELETE /news/:id
: Delete a news article by ID. (Note: TODO)
Contributions are welcome! Feel free to submit issues, suggest improvements, or open pull requests.
This project is licensed under the MIT License.