This Node.js application provides an API for managing articles. It allows users to perform CRUD (Create, Read, Update, Delete) operations on articles stored in a JSON file.
- Clone this repository.
- Install dependencies using
npm install
. - Run the application using
node app.js
.
- Returns a JSON array of all articles.
- Creates a new article.
- Requires a JSON object with
title
andcontent
fields in the request body. - Example request body:
{ "title": "New Article", "content": "This is the content of the new article." }
- Response: "Successfully added a new article."
- Deletes all articles.
- Response: "Successfully deleted all the articles."
- Returns the article with the specified title.
- If no article is found, returns "No article with that title found."
- Updates the content of the article with the specified title.
- Requires a JSON object with
newContent
field in the request body. - Response: "Successfully updated selected article."
- Updates the content of the article with the specified title.
- Requires a JSON object with
newContent
field in the request body. - Response: "Successfully updated the content of the selected article."
- Deletes the article with the specified title.
- Response: "Successfully deleted selected article."
- Express.js
- body-parser
- fs (File System)