A simple headless CMS (Content Management System) built with Node.js, Express, and MongoDB. This project provides basic API endpoints for managing articles, including CRUD operations, pagination, and search functionality.
- 📃 Retrieve a list of articles
- ➕ Create new articles
- ✏️ Update existing articles
- ❌ Delete articles
▶️ Pagination support- 🔎 Search articles by title or content
Before getting started, make sure you have the following prerequisites installed:
- Node.js and npm
- MongoDB installed locally or MongoDB Atlas account
-
Clone the repository:
git clone https://github.com/zeeshan8281/CMSify.git
-
Navigate to the project directory:
cd CMSify
-
Install dependencies:
npm install
-
Configure MongoDB connection:
-
Update the MongoDB connection URL in
app.js
:mongoose.connect('mongodb://localhost:27017/my-database', { useNewUrlParser: true, useUnifiedTopology: true });
-
-
Start the server:
node app.js
The server will start on port 5000 by default. You can change the port by setting the
PORT
environment variable.
- GET /articles: Retrieve a list of articles.
- POST /articles: Create a new article.
- PUT /articles/:id: Update an article by ID.
- DELETE /articles/:id: Delete an article by ID.
- GET /articles/search?q=search-term: Search for articles by title or content.
- GET /articles?page=page-number&limit=page-size: Retrieve paginated articles.
- Proper error handling with informative error messages and status codes.
Contributions are welcome! Please feel free to open issues or submit pull requests to improve this project.
This project is licensed under the MIT License - see the LICENSE file for details.