RomainNeup / forum_server_asp

My first .NET backend

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ForumAPI

Description

ForumAPI is a RESTful API built with ASP.NET Core that allows users to create, read, update, and delete categories, sections, subjects, and messages.

Installation

  1. Clone the repository: git clone git@github.com:RomainNeup/forum_server_asp.git
  2. Navigate to the project directory: cd ForumAPI**
  3. Restore the dependencies: dotnet restore**
  4. Build the project: dotnet build**
  5. Run the project: dotnet run**

Forum API Routes

Auth Routes


πŸ”“ POST /auth/register

Registers a new user account.

πŸ“„ Payload:

{
    "username": "string",
    "email": "string",
    "password": "string"
}

πŸ”“ POST /auth/login

Logs in a user and returns an authentication token.

πŸ“„ Payload:

{
    "email": "string",
    "password": "string"
}

Category Routes


πŸ” POST /categories

Creates a new category.

πŸ“„ Payload:

{
    "name": "string",
    "description": "string"
}

πŸ”“ GET /categories

Returns a list of all categories.


πŸ”“ GET /categories/{id}

Returns the details of a single category.


πŸ” PUT /categories/{id}

Updates an existing category.

πŸ“„ Payload:

{
    "name": "string",
    "description": "string"
}

πŸ” DELETE /categories/{id}

Deletes an existing category.

Section Routes


πŸ” POST /sections

Creates a new section in the specified category.

πŸ“„ Payload:

{
    "name": "string",
    "description": "string",
    "categoryId": "integer"
}

πŸ”“ GET /sections

Returns a list of all sections.


πŸ”“ GET /sections/{id}

Returns the details of a single section.


πŸ” PUT /sections/{id}

Updates an existing section.

πŸ“„ Payload:

{
    "name": "string",
    "description": "string"
}

πŸ” DELETE /sections/{id}

Deletes an existing section.

Subject Routes


πŸ” POST /sections/{sectionId}/subjects

Creates a new subject in the specified section.

πŸ“„ Payload:

{
    "name": "string",
    "text": "string"
}

πŸ”“ GET /sections/{sectionId}/subjects

Returns a list of all subjects in the specified section.


πŸ”“ GET /sections/{sectionId}/subjects/{id}

Returns the details of a single subject.


πŸ” PUT /sections/{sectionId}/subjects/{id}

Updates an existing subject.

πŸ“„ Payload:

{
    "name": "string",
    "text": "string"
}

πŸ” DELETE /sections/{sectionId}/subjects/{id}

Deletes an existing subject.

Message Routes


πŸ” POST /subjects/{subjectId}/messages

Creates a new message in the specified subject.

πŸ“„ Payload:

{
    "text": "string"
}

πŸ”“ GET /subjects/{subjectId}/messages

Returns a list of all messages in the specified subject.


πŸ”“ GET /subjects/{subjectId}/messages/{id}

Returns the details of a single message.


πŸ” PUT /subjects/{subjectId}/messages/{id}

Updates an existing message.

πŸ“„ Payload:

{
    "text": "string"
}

πŸ” DELETE /subjects/{subjectId}/messages/{id}

Deletes an existing message.


Note: πŸ” represents a protected route, which requires a JWT token to be sent in the request header as Bearer token, while πŸ”“ represents an unprotected route.

About

My first .NET backend


Languages

Language:C# 100.0%