This project provides a RESTful API using Express.js and MongoDB. It allows users to access routes to make API calls for a Wikipedia-like database. Users can perform operations such as retrieving articles, creating new articles, updating existing articles, and deleting articles.
Before setting up and using this project, ensure that you have the following installed:
- Clone the repository to your local machine:
git clone https://github.com/tristantanjh/Wiki-API.git
- Navigate to the project directory:
cd Wiki-API
- Install the dependencies:
npm install
- Install Nodemon (if not already installed):
npm install -g nodemon
- Start the MongoDB server:
mongod
-
Create a new MongoDB database called 'WikiDB'. You can use a MongoDB GUI tool like MongoDB Compass or Studio 3T to create the database.
-
Start the Express server - Runs on http://localhost:3000:
nodemon
- Use an API testing tool (e.g., Postman, cURL) to interact with the API using the available routes:
- Retrieve all articles:
GET http://localhost:3000/articles
- Create a new article:
POST http://localhost:3000/articles
Body:
{
"title": "Article Title",
"content": "Article Content"
}
- Delete all articles:
DELETE http://localhost:3000/articles
- Retrieve a specific article:
GET http://localhost:3000/articles/article-title
- Update a specific article:
PUT http://localhost:3000/articles/article-title
Body:
{
"title": "New Title",
"content": "New Content"
}
- Partially update a specific article:
PATCH http://localhost:3000/articles/article-title
Body:
{
"content": "Updated Content"
}
- Delete a specific article:
DELETE http://localhost:3000/articles/article-title
Contributions to this API are always welcome. If you have any suggestions, bug reports, or feature requests, please create an issue on the GitHub repository or submit a pull request.
- Angela Yu for her comprehensive web development bootcamp course, which served as the foundation for this project.