This repository contains the REST APIs for a personal blog application built with Django. The APIs allow users to register, login, and logout, as well as create, edit, and delete blog posts and comments.
The user APIs allow users to register, login, and logout.
- Signup: Users can create a new account by providing their email address, username, and password.
- URL:
http://localhost:8000/user/signup
- URL:
- Login: Users can log in to their account using their username and password.
- URL:
http://localhost:8000/user/login
- URL:
- Logout: Users can log out of their account.
- URL:
http://localhost:8000/user/logout
- URL:
The user has his own blog page, where he can add new blog posts. Non-authenticated users can see all blog posts, but cannot add new posts or comments. ONLY authenticated users can add comments on posts.
- Create comment: Users can create a new comment on a blog post by providing the content of the comment.
- URL:
http://localhost:8000/blog/comments/{id}/
- URL:
- Edit comment: Users can edit an existing comment on a blog post by providing the new content of the comment.
- URL:
http://localhost:8000/blog/comments/{id}
- URL:
- Delete comment: Users can delete an existing comment on a blog post.
- URL:
http://localhost:8000/blog/comments/{id}
- URL:
Before running the application, make sure you have the following software installed:
- Docker: Used to create, deploy, and run the application using containerization.
- Python: The programming language used for this project.
To run the application, you can follow these steps:
git clone https://github.com/OmarShamkh/blogapp-rest-apis.git
cd blogapp-rest-apis/
docker compose up
After running the "docker compose up" command, you should see a series of messages in your terminal as Docker builds and starts the containers. Once the application is running, you can verify it by navigating to http://localhost:8000/blog/posts in your web browser.
The application will be up and running at http://localhost:8000/blog/posts.
This project depends on the following packages:
- django-admin==2.0.1: A high-level Python web framework that encourages rapid development and clean, pragmatic design.
- django-cors-headers==3.13.0: A Django App that adds Cross-Origin Resource Sharing (CORS) headers to responses.
- djangorestframework==3.13.1: A powerful and flexible toolkit for building Web APIs in Django.
The frontend for the application is hosted at the following repository:
https://github.com/OmarShamkh/blogapp-frontend.git
Contributions are welcome! To contribute:
- Fork the repository.
- Create a new branch for your changes.
- Make your changes in your branch.
- Submit a pull request.
The project is organized into several main directories:
blog/
: Contains the models, views, and templates for the blog functionality.user/
: Contains the models, views, and templates for user authentication.Dockerfile
: Defines the Docker container for the application.