Git Product home page Git Product logo

blogapp-rest-apis's Introduction

Personal Blog REST APIs

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.

User APIs

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
  • Login: Users can log in to their account using their username and password.
    • URL: http://localhost:8000/user/login
  • Logout: Users can log out of their account.
    • URL: http://localhost:8000/user/logout

Blog APIs

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}/
  • 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}
  • Delete comment: Users can delete an existing comment on a blog post.
    • URL: http://localhost:8000/blog/comments/{id}

Prerequisites

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.

Running the application

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.

Dependencies

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.

Frontend

The frontend for the application is hosted at the following repository:

https://github.com/OmarShamkh/blogapp-frontend.git

Contributing

Contributions are welcome! To contribute:

  1. Fork the repository.
  2. Create a new branch for your changes.
  3. Make your changes in your branch.
  4. Submit a pull request.

Project Structure

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.

blogapp-rest-apis's People

Contributors

omarshamkh avatar sweep-ai[bot] avatar

Stargazers

 avatar  avatar

Watchers

 avatar

blogapp-rest-apis's Issues

Sweep: create an admin apis to add,edit,delete blog posts

Checklist
  • blog/views.py

• Create a new view class AdminPostDetail that inherits from APIView. This class should have the IsAdminUser permission class.
• In the AdminPostDetail class, create a post method that handles POST requests to add a new blog post. This method should use the Post model to create a new post.
• In the AdminPostDetail class, create a put method that handles PUT requests to edit an existing blog post. This method should use the Post model to update the post.
• In the AdminPostDetail class, create a delete method that handles DELETE requests to delete a blog post. This method should use the Post model to delete the post.

  • blog/urls.py

• Add a new URL pattern that maps to the AdminPostDetail view. The URL pattern should follow the format /admin/posts/{id} where id is the ID of the blog post.

  • blog/tests.py

• Write tests for the AdminPostDetail view. The tests should cover all possible scenarios including when the user is not an admin.

Sweep: update README file

Details

No response

Checklist
  • README.md

• Add a "Prerequisites" section before the "Running the application" section. This should include any software that needs to be installed before running the application, such as Docker and Python.
• Expand the "Running the application" section to include more details. For example, explain what the user should see in their terminal after running the "docker compose up" command, and how they can verify that the application is running correctly.
• Add a "Dependencies" section after the "Running the application" section. This should list all the project's dependencies, which can be found in the requirements.txt file. For each dependency, provide a brief description of what it is used for in the project.
• Add a "Contributing" section at the end of the README. This should explain how users can submit issues, propose changes, and adhere to the project's code of conduct. It should also encourage users to contribute and make clear that contributions are welcome.
• Add a "Project Structure" section that gives a brief overview of the project's structure and main components. This should explain the purpose of the main directories and files in the project, such as the blog and user directories and the Dockerfile.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.