Skip to content

Welcome to the BlogAPI project! This project is a simple yet robust blog API built with .NET 8, Entity Framework Core, and ASP.NET Core Identity. The API allows users to register, login, create blog posts, comment on blog posts and other comments, and like blog posts and comments.

License

Notifications You must be signed in to change notification settings

denizciMert/BlogAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BlogAPI Project

Introduction

Welcome to the BlogAPI project! This project is a simple yet robust blog API built with .NET 8, Entity Framework Core, and ASP.NET Core Identity. The API allows users to register, login, create blog posts, comment on blog posts and other comments, and like blog posts and comments. This project demonstrates a clean architecture and best practices in building a RESTful API.

Features

  • User registration and authentication using ASP.NET Core Identity
  • CRUD operations for blog posts
  • Nested comments on blog posts and other comments
  • Like functionality for blog posts and comments with unique constraints
  • Role-based authorization for managing blog content

Technologies

  • ASP.NET Core: ASP.NET Core is a cross-platform framework for building modern, cloud-based, and internet-connected applications.

  • Entity Framework: Entity Framework (EF) is an ORM for .NET that simplifies data access by allowing developers to work with database objects using .NET objects.

  • Identity Framework: ASP.NET Core Identity is a membership system that supports user authentication, authorization, and management.

  • MsSQL: Microsoft SQL Server (MsSQL) is a relational database management system that provides high performance, security, and data integrity.

  • Swagger: Swagger is a tool for designing, building, and documenting RESTful APIs with a user-friendly interface for testing endpoints.

Project Structure

    BlogAPI-SoftITO/
    ├── Controllers/
    ├── Data/
    ├── Entities/
    │ ├── Models/
    │ ├── DTOs/
    ├── Migrations/
    ├── Properties/
  • Controllers: Contains the API controllers for handling HTTP requests.
  • DTOs: Data Transfer Objects for transferring data between client and server.
  • Models: Entity models representing the database schema.
  • Data: Database context and configuration for Entity Framework Core.

Getting Started

Prerequisites

  • .NET 8 SDK
  • MsSQL Server (or any other compatible database)
  • Visual Studio or VS Code

Installation

  1. Clone the repository:

    git clone https://github.com/denizciMert/BlogAPI.git
  2. Set up the database connection string in appsettings.json:

    {
      "Logging": {
        "LogLevel": {
          "Default": "Information",
          "Microsoft.AspNetCore": "Warning"
        }
      },
      "AllowedHosts": "*",
      "ConnectionStrings": {
        "ApplicationDbContext": "YourConnectionString"
      }
    }
  3. Build and run the project:

    dotnet build
    dotnet run

API Endpoints

Account Management

Method Endpoint Description
POST /api/account/register Register a new user
POST /api/account/login Login a user
POST /api/account/logout Logout the current user

Blog Posts

Method Endpoint Description
GET /api/blogpost Get all blog posts
GET /api/blogpost/{id} Get a single blog post by ID
POST /api/blogpost Create a new blog post (authorized users only)
PUT /api/blogpost/{id} Update a blog post (authorized users only)
DELETE /api/blogpost/{id} Soft delete a blog post (authorized users only)

Comments

Method Endpoint Description
GET /api/comments Get all comments
GET /api/comments/{id} Get a single comment by ID
POST /api/comments Create a new comment (authorized users only)
PUT /api/comments/{id} Update a comment (authorized users only)
DELETE /api/comments/{id} Soft delete a comment (authorized users only)

Likes

Method Endpoint Description
POST /api/likes Like a blog post or comment (authorized users only)
DELETE /api/likes Unlike a blog post or comment (authorized users only)

Acknowledgements

  • This project was developed as part of the backend program at Softito Yazılım - Bilişim Akademisi.
  • Special thanks to the instructors and peers who provided valuable feedback and support throughout the development process.

About

Welcome to the BlogAPI project! This project is a simple yet robust blog API built with .NET 8, Entity Framework Core, and ASP.NET Core Identity. The API allows users to register, login, create blog posts, comment on blog posts and other comments, and like blog posts and comments.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages