This repository contains the backend implementation of a Blog App, built as part of Full Stack Open. The app provides a RESTful API for managing blog posts, including user authentication, CRUD operations, and database integration. Please note that the front-end is still under development and is not yet included in the repository.
- User authentication with JSON Web Tokens (JWT)
- CRUD operations for blogs (Create, Read, Update, Delete)
- User management (registration & login)
- MongoDB for data persistence
- Jest and Supertest for unit and integration testing
- Backend: Node.js, Express.js
- Database: MongoDB, Mongoose
- Authentication: bcrypt, JWT
- Testing: Jest, Supertest
- Linting & Code Formatting: ESLint, Prettier
- Development: Nodemon, dotenv
Ensure you have the following installed:
- Clone the repository:
git clone https://github.com/your-username/blog-app.git cd blog-app - Install dependencies:
npm install
- Set up environment variables:
- Create a
.envfile in the root directory and add the following:MONGODB_URI=<your_mongodb_connection_string> TEST_MONGODB_URI=<your_test_db_connection_string> PORT=3003 SECRET=<your_jwt_secret>
- Create a
Start the backend server:
npm run devThe server will run at http://localhost:3003
npm test| Method | Endpoint | Description |
|---|---|---|
| POST | /api/users |
Register a new user |
| POST | /api/login |
Authenticate user and get token |
| GET | /api/blogs |
Get all blogs |
| POST | /api/blogs |
Create a new blog (Auth required) |
| DELETE | /api/blogs/:id |
Delete a blog (Auth required) |
| PUT | /api/blogs/:id |
Update a blog (Auth required) |
- Implement frontend using React
- Add user roles and permissions
- Enable comment functionality on blogs
This project is licensed under the MIT License.
Created by Jeromy as part of Full Stack Open coursework.