This project is a Node.js based blogging system API that provides essential functionalities required for managing a blogging platform. It includes features such as user authentication, basic models for data management, and CRUD (Create, Read, Update, Delete) operations.
- User Authentication: Implemented secure authentication mechanisms to protect user data and control access.
- Basic Models: Defined fundamental data models to manage various entities within the blogging system.
- CRUD Operations: Comprehensive support for Create, Read, Update, and Delete operations to manage content effectively.
- Node.js: JavaScript runtime used to build the backend of the application.
- Express.js: Frameworks used to structure the application, providing a clean and maintainable architecture.
- MongoDB: NoSQL database for storing data.
- JWT: JSON Web Tokens for secure user authentication.
- Mongoose: MongoDB object modeling tool designed to work in an asynchronous environment.
- Jest: JavaScript testing framework for unit and integration tests.
-
Clone the repository:
git clone https://github.com/SugiraVinc/Summative-Project---DevOps-Node.js.git cd Summative-Project---DevOps-Node.js
-
Install dependencies:
npm install
-
Create a
.env
file in the root directory and add the following environment variables:PORT=3000 MONGODB_URI=mongodb://localhost:27017/blogging-system JWT_SECRET=your_jwt_secret NODE_ENV=development
-
Start the development server:
npm run dev
-
Run tests:
npm test
-
Authentication
POST /api/users/register
- Register a new userPOST /api/users/login
- Authenticate a user and retrieve a token
-
Blog Posts
GET /api/blogs
- Retrieve all blog postsPOST /api/blogs/create
- Create a new blog postGET /api/blogs/:id
- Retrieve a single blog post by IDPUT /api/blogs/edit/:id
- Update a blog post by IDDELETE /api/blogs/delete/:id
- Delete a blog post by ID
We welcome contributions from the community. To contribute, follow these steps:
- Fork the repository.
- Create a new branch:
git checkout -b feature/your-feature-name
. - Make your changes and commit them:
git commit -m 'Add some feature'
. - Push to the branch:
git push origin feature/your-feature-name
. - Open a pull request.
Used GitHub Actions to automate build
, test
, and deploy
.